Class TTextureFontData
Unit
Declaration
type TTextureFontData = class(TObject)
Description
Data for a 2D font initialized from a FreeType font file, like ttf.
Hierarchy
- TObject
- TTextureFontData
Overview
Nested Classes and Records
![]() |
TGlyph = class(TObject) |
![]() |
TGlyphDictionary = class(specialize TDictionary<TUnicodeChar,TGlyph>) |
Methods
![]() |
constructor Create(const AUrl: String; const ASize: Cardinal; const AnAntiAliased: Boolean; ACharacters: TUnicodeCharList = nil; const ADistanceField: Boolean = false); |
![]() |
constructor CreateFromData(const AGlyphs: TGlyphDictionary; const AImage: TGrayscaleImage; const ASize: Cardinal; const AnAntiAliased: Boolean); overload; |
![]() |
constructor CreateFromData(const AGlyphs: TGlyphDictionary; const AImage: TGrayscaleImage; const Information: TTextureFontDataInformation); overload; |
![]() |
destructor Destroy; override; |
![]() |
function Glyph(const C: TUnicodeChar; const AllowUsingFallbackGlyph: Boolean = true): TGlyph; |
![]() |
function LoadedGlyphs: TUnicodeCharList; |
![]() |
function TextWidth(const S: string): Integer; |
![]() |
function TextHeight(const S: string): Integer; |
![]() |
function TextHeightBase(const S: string): Integer; |
![]() |
function TextMove(const S: string): TVector2Integer; |
![]() |
function GlyphDrawImageRect(const G: TTextureFontData.TGlyph): TRectangle; |
Properties
![]() |
property Url: String read FUrl; |
![]() |
property Size: Cardinal read FSize; |
![]() |
property AntiAliased: Boolean read FAntiAliased; |
![]() |
property FamilyName: String read FFamilyName; |
![]() |
property StyleName: String read FStyleName; |
![]() |
property Bold: Boolean read FBold; |
![]() |
property Italic: Boolean read FItalic; |
![]() |
property UseFallbackGlyph: Boolean
read FUseFallbackGlyph write FUseFallbackGlyph default true; |
![]() |
property Image: TGrayscaleImage read FImage; |
![]() |
property DistanceField: Boolean read FDistanceField; |
Description
Methods
![]() |
constructor Create(const AUrl: String; const ASize: Cardinal; const AnAntiAliased: Boolean; ACharacters: TUnicodeCharList = nil; const ADistanceField: Boolean = false); |
Create by reading a FreeType font file, like ttf. Providing charaters list as Exceptions raised
|
![]() |
constructor CreateFromData(const AGlyphs: TGlyphDictionary; const AImage: TGrayscaleImage; const ASize: Cardinal; const AnAntiAliased: Boolean); overload; |
Create from a ready data for glyphs and image. Useful when font data is embedded inside the Pascal source code. AGlyphs instance, and AImage instance, become owned by this class. |
![]() |
constructor CreateFromData(const AGlyphs: TGlyphDictionary; const AImage: TGrayscaleImage; const Information: TTextureFontDataInformation); overload; |
This item has no description. |
![]() |
destructor Destroy; override; |
This item has no description. |
![]() |
function Glyph(const C: TUnicodeChar; const AllowUsingFallbackGlyph: Boolean = true): TGlyph; |
Read-only information about a glyph for given character. When AllowUsingFallbackGlyph and UseFallbackGlyph (both are When not (AllowUsingFallbackGlyph and UseFallbackGlyph) then we return |
![]() |
function LoadedGlyphs: TUnicodeCharList; |
List all characters for which glyphs are actually loaded. Glyph will answer non-nil exactly for these characters. The resulting list instance is owned by caller, so take care to free it. |
![]() |
function TextWidth(const S: string): Integer; |
This item has no description. |
![]() |
function TextHeight(const S: string): Integer; |
This item has no description. |
![]() |
function TextMove(const S: string): TVector2Integer; |
This item has no description. |
![]() |
function GlyphDrawImageRect(const G: TTextureFontData.TGlyph): TRectangle; |
Rect of the glyph in the image, without the additional padding added when rendering with distance field fonts. To get the full rect of the glyph in the image, with padding, use G.ImageX, G.ImageY, G.Width, G.Height. |
Properties
![]() |
property Url: String read FUrl; |
This item has no description. |
![]() |
property Size: Cardinal read FSize; |
Size of the font data (which is the optimal size to display this font, without any scaling), in pixels. |
![]() |
property AntiAliased: Boolean read FAntiAliased; |
Whether the font data was generated with anti-aliasing. |
![]() |
property FamilyName: String read FFamilyName; |
Family name, obtained from the font file. |
![]() |
property StyleName: String read FStyleName; |
Style name, obtained from the font file. This should correspond to the Bold and Italic properties, but e.g. "Italic" may be called "Oblique" depending on how it was generated. |
![]() |
property Bold: Boolean read FBold; |
Is the font a bold font (obtained from the font file). |
![]() |
property Italic: Boolean read FItalic; |
Is the font an italic font (obtained from the font file). |
![]() |
property UseFallbackGlyph: Boolean
read FUseFallbackGlyph write FUseFallbackGlyph default true; |
When a glyph (picture of a particular character) in a font doesn't exist, by default we make a warning (using WritelnWarning) and use a fallback glyph, like "?". This lets user know that some character is there. Set this to |
![]() |
property Image: TGrayscaleImage read FImage; |
This item has no description. |
![]() |
property DistanceField: Boolean read FDistanceField; |
Is the font prepared for distance field rendering. |
Generated by PasDoc 0.16.0-snapshot.