Skip to content

TBLGlyphBuffer

Glyph buffer.

Can hold either text or glyphs and provides basic memory management that is used for text shaping, character to glyph mapping, glyph substitution, and glyph positioning.

Glyph buffer provides two separate buffers called 'Primary' and 'Secondary' that serve different purposes during processing. Primary buffer always holds actual text/glyph array, and secondary buffer is either used as a scratch buffer during glyph substitution or to hold glyph positions after the processing is complete and glyph positions were calculated.

Definition

Unit: Blend2D

type TBLGlyphBuffer = record ... end;

Properties

Name Description
Content
Flags
GlyphRun
HasGlyphs Whether the buffer contains glyph-id data.
HasInvalidChars Tests whether the input string contained invalid characters (unicode encoding errors).
HasInvalidFontData Whether one or more operation was terminated before completion because of invalid data in a font.
HasText Whether the buffer contains unicode data.
HasUndefinedChars Whether the input string contained undefined characters that weren't mapped properly to glyphs.
InfoData
IsEmpty
PlacementData
Size

Constructors

Name Description
Assign Copying a glyph buffer is not allowed. This will raise a EBlend2DError exception with result TBLResult.NotPermitted.
Finalize Destroys the glyph buffer.
Initialize Creates a default constructed glyph buffer.

Operators

Name Description
Equal Used to compare against nil.
NotEqual Used to compare against nil.

Methods

Name Description
Clear Clears the content of TBLGlyphBuffer without releasing internal buffers.
HasFlag Tests whether the glyph-buffer has AFlag set.
Reset Resets the TBLGlyphBuffer into its default constructed state. The content will be cleared and allocated memory released.
ResetDebugSink
SetDebugSink
SetGlyphs(PUInt32, NativeInt) Assigns a glyph content of this TBLGlyphBuffer from the given AGlyphData.
SetGlyphs(TArray<UInt32>) Assigns a glyph content of this TBLGlyphBuffer from the given AGlyphData.
SetGlyphsFromRecord Assigns a glyph content of this TBLGlyphBuffer from an array of glyphs or from a foreign record that contains glyphs and possibly other members that have to be skipped. The glyph size can be either 16-bit (2) or 32-bit (4). The last parameter AGlyphAdvance specifies how many bytes to advance after a glyph value is read.
SetLatin1Text Assigns a text content of this TBLGlyphBuffer from LATIN1 (ISO/IEC 8859-1) string.
SetText(Pointer, NativeInt, TBLTextEncoding) Assigns a text content of this TBLGlyphBuffer.
SetText(AnsiString) Assigns a text content of this TBLGlyphBuffer.
SetText(UCS4String) Assigns a text content of this TBLGlyphBuffer.
SetText(UTF8String) Assigns a text content of this TBLGlyphBuffer.
SetText(String) Assigns a text content of this TBLGlyphBuffer.
SetUtf16Text Assigns a text content of this TBLGlyphBuffer from UTF-16 encoded string. The ALength parameter represents the length of the AText in 16-bit units.
SetUtf32Text Assigns a text content of this TBLGlyphBuffer from UTF-32 encoded string. The ALength parameter represents the length of the AText in 32-bit units.
SetUtf8Text Assigns a text content of this TBLGlyphBuffer from UTF-8 encoded string. The ALength parameter represents the length of the AText in bytes.

Property Descriptions

Content

property Content: PUInt32 read GetContent

Type: PUInt32


Flags

property Flags: TBLGlyphRunFlags read GetFlags

Type: TBLGlyphRunFlags


GlyphRun

property GlyphRun: TBLGlyphRun read GetGlyphRun

Type: TBLGlyphRun


HasGlyphs

Whether the buffer contains glyph-id data.

property HasGlyphs: Boolean read GetHasGlyphs

Type: Boolean


HasInvalidChars

Tests whether the input string contained invalid characters (unicode encoding errors).

property HasInvalidChars: Boolean read GetHasInvalidChars

Type: Boolean


HasInvalidFontData

Whether one or more operation was terminated before completion because of invalid data in a font.

property HasInvalidFontData: Boolean read GetHasInvalidFontData

Type: Boolean


HasText

Whether the buffer contains unicode data.

property HasText: Boolean read GetHasText

Type: Boolean


HasUndefinedChars

Whether the input string contained undefined characters that weren't mapped properly to glyphs.

property HasUndefinedChars: Boolean read GetHasUndefinedChars

Type: Boolean


InfoData

property InfoData: PBLGlyphInfo read GetInfoData

Type: PBLGlyphInfo


IsEmpty

property IsEmpty: Boolean read GetIsEmpty

Type: Boolean


PlacementData

property PlacementData: PBLGlyphPlacement read GetPlacementData

Type: PBLGlyphPlacement


Size

property Size: NativeInt read GetSize

Type: NativeInt


Constructor Descriptions

Assign

Copying a glyph buffer is not allowed. This will raise a EBlend2DError exception with result TBLResult.NotPermitted.

constructor Assign(var ADest: TBLGlyphBuffer; const ASrc: TBLGlyphBuffer); inline

Parameters

ADest: TBLGlyphBuffer

ASrc: TBLGlyphBuffer

Exceptions

EBlend2DError: Raised on failure.


Finalize

Destroys the glyph buffer.

destructor Finalize(var ADest: TBLGlyphBuffer)

Parameters

ADest: TBLGlyphBuffer

Exceptions

EBlend2DError: Raised on failure.


Initialize

Creates a default constructed glyph buffer.

constructor Initialize(out ADest: TBLGlyphBuffer)

Parameters

ADest: TBLGlyphBuffer

Exceptions

EBlend2DError: Raised on failure.


Operator Descriptions

Equal(TBLGlyphBuffer, Pointer)

Used to compare against nil.

class operator Equal(const ALeft: TBLGlyphBuffer; const ARight: Pointer): Boolean; inline; static

Parameters

ALeft: TBLGlyphBuffer

ARight: Pointer

Returns

Boolean


NotEqual(TBLGlyphBuffer, Pointer)

Used to compare against nil.

class operator NotEqual(const ALeft: TBLGlyphBuffer; const ARight: Pointer): Boolean; inline; static

Parameters

ALeft: TBLGlyphBuffer

ARight: Pointer

Returns

Boolean


Method Descriptions

Clear

Clears the content of TBLGlyphBuffer without releasing internal buffers.

procedure Clear; inline

Exceptions

EBlend2DError: Raised on failure.


HasFlag(TBLGlyphRunFlag)

Tests whether the glyph-buffer has AFlag set.

function HasFlag(const AFlag: TBLGlyphRunFlag): Boolean; inline

Parameters

AFlag: TBLGlyphRunFlag

Returns

Boolean


Reset

Resets the TBLGlyphBuffer into its default constructed state. The content will be cleared and allocated memory released.

procedure Reset; inline

Exceptions

EBlend2DError: Raised on failure.


ResetDebugSink

procedure ResetDebugSink; inline


SetDebugSink(TBLDebugMessageSinkFunc, Pointer)

procedure SetDebugSink(const ASink: TBLDebugMessageSinkFunc; const AUserData: Pointer = nil); inline

Parameters

ASink: TBLDebugMessageSinkFunc

AUserData: Pointer = nil


SetGlyphs(PUInt32, NativeInt)

Assigns a glyph content of this TBLGlyphBuffer from the given AGlyphData.

procedure SetGlyphs(const AGlyphData: PUInt32; const ASize: NativeInt); overload; inline

Exceptions

EBlend2DError: Raised on failure.

Parameters

AGlyphData: PUInt32

ASize: NativeInt


SetGlyphs(TArray<UInt32>)

Assigns a glyph content of this TBLGlyphBuffer from the given AGlyphData.

procedure SetGlyphs(const AGlyphData: TArray<UInt32>); overload; inline

Exceptions

EBlend2DError: Raised on failure.

Parameters

AGlyphData: TArray<UInt32>


SetGlyphsFromRecord(Pointer, NativeInt, NativeInt, NativeInt)

Assigns a glyph content of this TBLGlyphBuffer from an array of glyphs or from a foreign record that contains glyphs and possibly other members that have to be skipped. The glyph size can be either 16-bit (2) or 32-bit (4). The last parameter AGlyphAdvance specifies how many bytes to advance after a glyph value is read.

procedure SetGlyphsFromRecord(const AGlyphData: Pointer; const ASize, AGlyphIdSize, AGlyphAdvance: NativeInt); inline

Exceptions

EBlend2DError: Raised on failure.

Parameters

AGlyphData: Pointer

ASize: NativeInt

AGlyphIdSize: NativeInt

AGlyphAdvance: NativeInt


SetLatin1Text(PAnsiChar, NativeInt)

Assigns a text content of this TBLGlyphBuffer from LATIN1 (ISO/IEC 8859-1) string.

procedure SetLatin1Text(const AText: PAnsiChar; const ALength: NativeInt = -1); inline

Exceptions

EBlend2DError: Raised on failure.

Parameters

AText: PAnsiChar

ALength: NativeInt = -1


SetText(Pointer, NativeInt, TBLTextEncoding)

Assigns a text content of this TBLGlyphBuffer.

This is a generic function that accepts a pointer to data, which is specified by AEncoding. The ASize argument depends on encoding as well. If the encoding specifies byte string (Latin1 or Utf8) then it's bytes, if the encoding specifies Utf16 or Utf32 then it would describe the number of UInt16 or UInt32 code points, respectively.

Null-terminated string can be specified by passing -1 as ASize.

procedure SetText(const ATextData: Pointer; const ASize: NativeInt; const AEncoding: TBLTextEncoding); overload; inline

Exceptions

EBlend2DError: Raised on failure.

Parameters

ATextData: Pointer

ASize: NativeInt

AEncoding: TBLTextEncoding


SetText(AnsiString)

Assigns a text content of this TBLGlyphBuffer.

procedure SetText(const AText: AnsiString); overload; inline

Exceptions

EBlend2DError: Raised on failure.

Parameters

AText: AnsiString


SetText(UCS4String)

Assigns a text content of this TBLGlyphBuffer.

procedure SetText(const AText: UCS4String); overload; inline

Exceptions

EBlend2DError: Raised on failure.

Parameters

AText: UCS4String


SetText(UTF8String)

Assigns a text content of this TBLGlyphBuffer.

procedure SetText(const AText: UTF8String); overload; inline

Exceptions

EBlend2DError: Raised on failure.

Parameters

AText: UTF8String


SetText(String)

Assigns a text content of this TBLGlyphBuffer.

procedure SetText(const AText: String); overload; inline

Exceptions

EBlend2DError: Raised on failure.

Parameters

AText: String


SetUtf16Text(PWideChar, NativeInt)

Assigns a text content of this TBLGlyphBuffer from UTF-16 encoded string. The ALength parameter represents the length of the AText in 16-bit units.

procedure SetUtf16Text(const AText: PWideChar; const ALength: NativeInt = -1); inline

Exceptions

EBlend2DError: Raised on failure.

Parameters

AText: PWideChar

ALength: NativeInt = -1


SetUtf32Text(PUCS4Char, NativeInt)

Assigns a text content of this TBLGlyphBuffer from UTF-32 encoded string. The ALength parameter represents the length of the AText in 32-bit units.

procedure SetUtf32Text(const AText: PUCS4Char; const ALength: NativeInt = -1); inline

Exceptions

EBlend2DError: Raised on failure.

Parameters

AText: PUCS4Char

ALength: NativeInt = -1


SetUtf8Text(PUTF8Char, NativeInt)

Assigns a text content of this TBLGlyphBuffer from UTF-8 encoded string. The ALength parameter represents the length of the AText in bytes.

procedure SetUtf8Text(const AText: PUTF8Char; const ALength: NativeInt = -1); inline

Exceptions

EBlend2DError: Raised on failure.

Parameters

AText: PUTF8Char

ALength: NativeInt = -1