Class TTextureFontData
Unit
Declaration
type TTextureFontData = class(TObject)
Description
Data for a 2D font initialized from a FreeType font file, like ttf.
Source: ../castle-engine/src/fonts/castletexturefontdata.pas (line 95).
Hierarchy
- TObject
- TTextureFontData
Overview
Nested Classes and Records
| Public | TGlyph = class(TObject) |
| Public | TGlyphDictionary = class(specialize TDictionary<TUnicodeChar,TGlyph>) |
Methods
| Public | constructor Create(const AUrl: String; const ASize: Cardinal; const AnAntiAliased: Boolean; ACharacters: TUnicodeCharSet = nil; const ADistanceField: Boolean = false); |
| Public | constructor CreateFromData(const AGlyphs: TGlyphDictionary; const AImage: TGrayscaleImage; const ASize: Cardinal; const AnAntiAliased: Boolean); overload; |
| Public | constructor CreateFromData(const AGlyphs: TGlyphDictionary; const AImage: TGrayscaleImage; const Information: TTextureFontDataInformation); overload; |
| Public | destructor Destroy; override; |
| Public | function Glyph(const C: TUnicodeChar; const AllowUsingFallbackGlyph: Boolean = true): TGlyph; |
| Public | function LoadedGlyphs: TUnicodeCharSet; |
| Public | function TextWidth(const S: string): Integer; |
| Public | function TextHeight(const S: string): Integer; |
| Public | function TextHeightBase(const S: string): Integer; |
| Public | function TextMove(const S: string): TVector2Integer; |
| Public | function GlyphDrawImageRect(const G: TTextureFontData.TGlyph): TRectangle; |
Properties
| Public | property Url: String read FUrl; |
| Public | property Size: Cardinal read FSize; |
| Public | property AntiAliased: Boolean read FAntiAliased; |
| Public | property FamilyName: String read FFamilyName; |
| Public | property StyleName: String read FStyleName; |
| Public | property Bold: Boolean read FBold; |
| Public | property Italic: Boolean read FItalic; |
| Public | property UseFallbackGlyph: Boolean
read FUseFallbackGlyph write FUseFallbackGlyph default true; |
| Public | property Image: TGrayscaleImage read FImage; |
| Public | property DistanceField: Boolean read FDistanceField; |
Description
Methods
| Public | constructor Create(const AUrl: String; const ASize: Cardinal; const AnAntiAliased: Boolean; ACharacters: TUnicodeCharSet = nil; const ADistanceField: Boolean = false); |
|
Create by reading a FreeType font file, like ttf. Providing charaters list as Exceptions raised
Source: ../castle-engine/src/fonts/castletexturefontdata.pas (line 204). | |
| Public | 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. Source: ../castle-engine/src/fonts/castletexturefontdata.pas (line 211). | |
| Public | constructor CreateFromData(const AGlyphs: TGlyphDictionary; const AImage: TGrayscaleImage; const Information: TTextureFontDataInformation); overload; |
|
This item has no description. Source: ../castle-engine/src/fonts/castletexturefontdata.pas (line 214). | |
| Public | destructor Destroy; override; |
|
This item has no description. Source: ../castle-engine/src/fonts/castletexturefontdata.pas (line 218). | |
| Public | 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 Source: ../castle-engine/src/fonts/castletexturefontdata.pas (line 254). | |
| Public | function LoadedGlyphs: TUnicodeCharSet; |
|
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. Source: ../castle-engine/src/fonts/castletexturefontdata.pas (line 271). | |
| Public | function TextWidth(const S: string): Integer; |
|
This item has no description. Source: ../castle-engine/src/fonts/castletexturefontdata.pas (line 273). | |
| Public | function TextHeight(const S: string): Integer; |
|
This item has no description. Source: ../castle-engine/src/fonts/castletexturefontdata.pas (line 274). | |
| Public | function TextHeightBase(const S: string): Integer; |
|
The height (above the baseline) of the text. This doesn't take into account height of the text below the baseline (for example letter "y" has the tail below the baseline in most fonts). Source: ../castle-engine/src/fonts/castletexturefontdata.pas (line 278). | |
| Public | function TextMove(const S: string): TVector2Integer; |
|
This item has no description. Source: ../castle-engine/src/fonts/castletexturefontdata.pas (line 279). | |
| Public | 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. Source: ../castle-engine/src/fonts/castletexturefontdata.pas (line 289). | |
Properties
| Public | property Url: String read FUrl; |
|
This item has no description. Source: ../castle-engine/src/fonts/castletexturefontdata.pas (line 220). | |
| Public | property Size: Cardinal read FSize; |
|
Size of the font data (which is the optimal size to display this font, without any scaling), in pixels. Source: ../castle-engine/src/fonts/castletexturefontdata.pas (line 224). | |
| Public | property AntiAliased: Boolean read FAntiAliased; |
|
Whether the font data was generated with anti-aliasing. Source: ../castle-engine/src/fonts/castletexturefontdata.pas (line 227). | |
| Public | property FamilyName: String read FFamilyName; |
|
Family name, obtained from the font file. Source: ../castle-engine/src/fonts/castletexturefontdata.pas (line 230). | |
| Public | 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. Source: ../castle-engine/src/fonts/castletexturefontdata.pas (line 235). | |
| Public | property Bold: Boolean read FBold; |
|
Is the font a bold font (obtained from the font file). Source: ../castle-engine/src/fonts/castletexturefontdata.pas (line 238). | |
| Public | property Italic: Boolean read FItalic; |
|
Is the font an italic font (obtained from the font file). Source: ../castle-engine/src/fonts/castletexturefontdata.pas (line 241). | |
| Public | 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 Source: ../castle-engine/src/fonts/castletexturefontdata.pas (line 263). | |
| Public | property Image: TGrayscaleImage read FImage; |
|
This item has no description. Source: ../castle-engine/src/fonts/castletexturefontdata.pas (line 266). | |
| Public | property DistanceField: Boolean read FDistanceField; |
|
Is the font prepared for distance field rendering. Source: ../castle-engine/src/fonts/castletexturefontdata.pas (line 282). | |
Generated by PasDoc 0.17.0.snapshot.