BLGlyphBuffer Class Reference

Glyph buffer [C++ API].

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.

Member Functions

Constructors & Destructors
Overloaded Operators
Accessors
Operations

Additional Inherited Members

- Public Attributes inherited from BLGlyphBufferCore

Member Function Documentation

bool BLGlyphBuffer::hasFlag(uint32_t flag) const

Tests whether the glyph-buffer has flag set.

bool BLGlyphBuffer::hasText() const

Tests whether the buffer contains unicode data.

bool BLGlyphBuffer::hasGlyphs() const

Tests whether the buffer contains glyph-id data.

bool BLGlyphBuffer::hasInvalidChars() const

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

bool BLGlyphBuffer::hasUndefinedChars() const

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

bool BLGlyphBuffer::hasInvalidFontData() const

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

BLResult BLGlyphBuffer::reset()

Resets the BLGlyphBuffer into its construction state. The content will be cleared and allocated memory released.

BLResult BLGlyphBuffer::clear()

Clears the content of BLGlyphBuffer without releasing internal buffers.

BLResult BLGlyphBuffer::setText(const void* textData, size_t size, uint32_t encoding)

Assigns a text content of this BLGlyphBuffer.

This is a generic function that accepts void* data, which is specified by encoding. The size 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_t or uint32_t code points, respectively.

Null-terminated string can be specified by passing SIZE_MAX as size.

BLResult BLGlyphBuffer::setLatin1Text(const char* text, size_t size = SIZE_MAX)

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

BLResult BLGlyphBuffer::setUtf8Text(const char* text, size_t size = SIZE_MAX)[1/2]

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

BLResult BLGlyphBuffer::setUtf8Text(const uint8_t* text, size_t size = SIZE_MAX)[2/2]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

BLResult BLGlyphBuffer::setUtf16Text(const uint16_t* text, size_t size = SIZE_MAX)

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

BLResult BLGlyphBuffer::setUtf32Text(const uint32_t* text, size_t size = SIZE_MAX)

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

BLResult BLGlyphBuffer::setWCharText(const wchar_t* text, size_t size = SIZE_MAX)

Assigns a text content of this BLGlyphBuffer from wchar_t encoded string. The size parameter represents the length of the text in wchar_t units.

BLResult BLGlyphBuffer::setGlyphs(const uint32_t* glyphData, size_t size)

Assigns a glyph content of this BLGlyphBuffer from either the given glyphData.

BLResult BLGlyphBuffer::setGlyphsFromStruct(const void* glyphData, size_t size, size_t glyphIdSize, intptr_t glyphAdvance)

Assigns a glyph content of this BLGlyphBuffer from an array of glyphs or from a foreign structure 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 glyphAdvance specifies how many bytes to advance after a glyph value is read.