TBLFontData
Font data.
Definition
Unit: Blend2D
Properties
Name | Description |
---|---|
FaceCount | The number of faces of this font data. |
FaceType | Type of font face that this data describes. |
Flags | Returns font data flags. |
IsCollection | Whether this font data is a font-collection. |
IsEmpty | Whether the font data is empty, which is the same as not IsValid . |
IsValid | Whether the font data is not a built-in null instance. |
Constructors
Name | Description |
---|---|
Assign | Copy constructor makes a weak copy of the underlying representation of the ASrc font data. |
Finalize | Destroys the font data. |
Initialize | Creates a default initialized font data. |
Operators
Name | Description |
---|---|
Equal(TBLFontData, TBLFontData) | Returns True if two font data instances are equal (have the same contents). |
Equal(TBLFontData, Pointer) | Used to compare against nil (empty font data). |
NotEqual(TBLFontData, TBLFontData) | Returns True if two font data instances are not equal (do not have the same contents). |
NotEqual(TBLFontData, Pointer) | Used to compare against nil (empty font data). |
Methods
Name | Description |
---|---|
Equals | Tests whether this and AOther font data are equal. |
GetTable | |
GetTables | |
GetTableTags(Integer) | Returns an array with all table tags provided by font face at the given AFaceIndex . |
GetTableTags(Integer, TBLArray<TBLTag>) | Populates ADst array with all table tags provided by font face at the given AFaceIndex . |
MakeFromData(Pointer, NativeInt, TBLDestroyExternalDataFunc, Pointer) | Creates TBLFontData from the given AData of the given ASize . |
MakeFromData(TBLArray<Byte>) | Creates a TBLFontData from the given AData stored in `TBLArray |
MakeFromData(TBytes) | Creates a TBLFontData from the given AData . |
MakeFromFile | Creates a TBLFontData from a file specified by the given AFilename . |
Reset | |
Swap |
Property Descriptions
FaceCount
The number of faces of this font data.
If the data is not initialized the result would be always zero. If the data is initialized to a single font it would be 1, and if the data is initialized to a font collection then the return would correspond to the number of font faces within that collection.
property FaceCount: Integer read GetFaceCount
Type: Integer
See Also
Remarks
You should not use FaceCount
to check whether the font is a collection as it's possible to have a font-collection with just a single font. Using IsCollection
is more reliable and would always return the right value.
FaceType
Type of font face that this data describes.
It doesn't matter if the content is a single font or a collection. In any case the FaceType
would always return the type of the font face that will be created by TBLFontFace.MakeFromData
.
property FaceType: TBLFontFaceType read GetFaceType
Type: TBLFontFaceType
See Also
Flags
Returns font data flags.
property Flags: TBLFontDataFlags read GetFlags
Type: TBLFontDataFlags
IsCollection
Whether this font data is a font-collection.
property IsCollection: Boolean read GetIsCollection
Type: Boolean
IsEmpty
Whether the font data is empty, which is the same as not IsValid
.
property IsEmpty: Boolean read GetIsEmpty
Type: Boolean
IsValid
Whether the font data is not a built-in null instance.
property IsValid: Boolean read GetIsValid
Type: Boolean
Constructor Descriptions
Assign
Copy constructor makes a weak copy of the underlying representation of the ASrc
font data.
constructor Assign(var ADest: TBLFontData; const ASrc: TBLFontData); inline
Parameters
ADest
: TBLFontData
ASrc
: TBLFontData
Exceptions
EBlend2DError
: Raised on failure.
Finalize
Destroys the font data.
destructor Finalize(var ADest: TBLFontData)
Parameters
ADest
: TBLFontData
Exceptions
EBlend2DError
: Raised on failure.
Initialize
Creates a default initialized font data.
constructor Initialize(out ADest: TBLFontData)
Parameters
ADest
: TBLFontData
Exceptions
EBlend2DError
: Raised on failure.
Operator Descriptions
Equal(TBLFontData, TBLFontData)
Returns True if two font data instances are equal (have the same contents).
class operator Equal(const ALeft, ARight: TBLFontData): Boolean; inline; static
Parameters
ALeft
: TBLFontData
ARight
: TBLFontData
Returns
Boolean
Equal(TBLFontData, Pointer)
Used to compare against nil
(empty font data).
class operator Equal(const ALeft: TBLFontData; const ARight: Pointer): Boolean; inline; static
Parameters
ALeft
: TBLFontData
ARight
: Pointer
Returns
Boolean
NotEqual(TBLFontData, TBLFontData)
Returns True if two font data instances are not equal (do not have the same contents).
class operator NotEqual(const ALeft, ARight: TBLFontData): Boolean; inline; static
Parameters
ALeft
: TBLFontData
ARight
: TBLFontData
Returns
Boolean
NotEqual(TBLFontData, Pointer)
Used to compare against nil
(empty font data).
class operator NotEqual(const ALeft: TBLFontData; const ARight: Pointer): Boolean; inline; static
Parameters
ALeft
: TBLFontData
ARight
: Pointer
Returns
Boolean
Method Descriptions
Equals(TBLFontData)
Tests whether this and AOther
font data are equal.
function Equals(const AOther: TBLFontData): Boolean; inline
Parameters
AOther
: TBLFontData
Returns
Boolean
GetTable(Integer, TBLTag)
function GetTable(const AFaceIndex: Integer; const ATag: TBLTag): TBLFontTable; inline
Parameters
AFaceIndex
: Integer
ATag
: TBLTag
Returns
GetTables(Integer, TArray<TBLTag>)
function GetTables(const AFaceIndex: Integer; const ATags: TArray<TBLTag>): TArray<TBLFontTable>; inline
Parameters
AFaceIndex
: Integer
ATags
: TArray<TBLTag>
Returns
TArray<TBLFontTable>
GetTableTags(Integer)
Returns an array with all table tags provided by font face at the given AFaceIndex
.
function GetTableTags(const AFaceIndex: Integer): TArray<TBLTag>; overload; inline
Exceptions
EBlend2DError
: Raised on failure.
Parameters
AFaceIndex
: Integer
Returns
TArray<TBLTag>
GetTableTags(Integer, TBLArray<TBLTag>)
Populates ADst
array with all table tags provided by font face at the given AFaceIndex
.
procedure GetTableTags(const AFaceIndex: Integer; const ADst: TBLArray<TBLTag>); overload; inline
Exceptions
EBlend2DError
: Raised on failure.
Parameters
AFaceIndex
: Integer
ADst
: TBLArray<TBLTag>
MakeFromData(Pointer, NativeInt, TBLDestroyExternalDataFunc, Pointer)
Creates TBLFontData
from the given AData
of the given ASize
.
procedure MakeFromData(const AData: Pointer; const ASize: NativeInt; const ADestroyFunc: TBLDestroyExternalDataFunc = nil; const AUserData: Pointer = nil); overload; inline
Exceptions
EBlend2DError
: Raised on failure.
Parameters
AData
: Pointer
ASize
: NativeInt
ADestroyFunc
: TBLDestroyExternalDataFunc = nil
AUserData
: Pointer = nil
Remarks
Optionally an ADestroyFunc
can be used as a notifier that will be called when the data is no longer needed. Destroy func will be called with AUserData
.
MakeFromData(TBLArray<Byte>)
Creates a TBLFontData
from the given AData
stored in TBLArray<byte>
.
The given AData
would be weak copied on success so the given array can be safely destroyed after the function returns. AData
is internal and there is no API to access it after the function returns. The reason for making it internal is that multiple implementations of TBLFontData
may exist and some can only store data at table level, so Blend2D doesn't expose the detail about how the data is stored.
procedure MakeFromData(const AData: TBLArray<Byte>); overload; inline
Parameters
AData
: TBLArray<Byte>
MakeFromData(TBytes)
Creates a TBLFontData
from the given AData
.
procedure MakeFromData(const AData: TBytes); overload; inline
Exceptions
EBlend2DError
: Raised on failure.
Parameters
AData
: TBytes
MakeFromFile(String, TBLFileReadFlags)
Creates a TBLFontData
from a file specified by the given AFilename
.
procedure MakeFromFile(const AFilename: String; const AReadFlags: TBLFileReadFlags = []); inline
Exceptions
EBlend2DError
: Raised on failure.
Parameters
AFilename
: String
AReadFlags
: TBLFileReadFlags = []
Remarks
The AReadFlags
argument allows to specify flags that will be passed to TBLFileSystem.ReadFile
to read the content of the file. It's possible to use memory mapping to get its content, which is the recommended way for reading system fonts. The best combination is to use TBLFileReadFlag.MmapEnabled
flag combined with TBLFileReadFlag.MmapAvoidSmall
. This combination means to try to use memory mapping only when the size of the font is greater than a minimum value (determined by Blend2D), and would fallback to a regular open/read in case the memory mapping is not possible or failed for some other reason. Please note that not all files can be memory mapped so TBLFileReadFlag.MmapNoFallback
flag is not recommended.
Reset
procedure Reset; inline
Swap(TBLFontData)
procedure Swap(var AOther: TBLFontData); inline
Parameters
AOther
: TBLFontData