ConstFont
A ConstFont is a Font implementation that has its contents defined at compile-time and usually placed in read-only memory.
See: Font
Note: Pure virtual class. Create an application-specific implementation of getPixelData().
Inherits from: Font
Inherited by: InternalFlashFont
Public Functions
ConstFont(const GlyphNode * list, uint16_t size, uint16_t height, uint8_t pixBelowBase, uint8_t bitsPerPixel, uint8_t byteAlignRow, uint8_t maxLeft, uint8_t maxRight, const Unicode::UnicodeChar fallbackChar, const Unicode::UnicodeChar ellipsisChar) | |
Initializes a new instance of the ConstFont class. | |
const GlyphNode * | find(Unicode::UnicodeChar unicode) const |
Finds the glyph data associated with the specified unicode. | |
const GlyphNode * | getGlyph(Unicode::UnicodeChar unicode) |
Gets the glyph data associated with the specified Unicode. | |
virtual const GlyphNode * | getGlyph(Unicode::UnicodeChar unicode, const uint8_t *& pixelData, uint8_t & bitsPerPixel) const |
Gets the glyph data associated with the specified Unicode. | |
const GlyphNode * | getGlyph(Unicode::UnicodeChar unicode, const uint8_t *& pixelData, uint8_t & bitsPerPixel) |
Gets the glyph data associated with the specified Unicode. | |
virtual int8_t | getKerning(Unicode::UnicodeChar prevChar, const GlyphNode * glyph) const =0 |
Gets the kerning distance between two characters. | |
virtual const uint8_t * | getPixelData(const GlyphNode * glyph) const =0 |
Gets the pixel date associated with this glyph. | |
Protected Attributes
Additional inherited members
Public Functions inherited from Font
virtual FORCE_INLINE_FUNCTION uint8_t | getBitsPerPixel() const |
Gets bits per pixel for this font. | |
virtual FORCE_INLINE_FUNCTION uint8_t | getByteAlignRow() const |
Are the glyphs saved with each glyph row byte aligned? | |
virtual uint16_t | getCharWidth(const Unicode::UnicodeChar c) const |
Gets the width in pixels of the specified character. | |
virtual const FontContextualFormsTable * | getContextualFormsTable() const |
Gets the contextual forms table used in arabic fonts. | |
virtual Unicode::UnicodeChar | getEllipsisChar() const |
Gets ellipsis character for the given font. | |
virtual Unicode::UnicodeChar | getFallbackChar() const |
Gets fallback character for the given font. | |
virtual FORCE_INLINE_FUNCTION uint16_t | getFontHeight() const |
Returns the height in pixels of this font. | |
virtual const uint16_t * | getGSUBTable() const |
Gets GSUB table. | |
FORCE_INLINE_FUNCTION uint8_t | getMaxPixelsLeft() const |
Gets maximum pixels left of any glyph in the font. | |
FORCE_INLINE_FUNCTION uint8_t | getMaxPixelsRight() const |
Gets maximum pixels right of any glyph in the font. | |
virtual uint16_t | getMaxTextHeight(const Unicode::UnicodeChar * text, ... ) const |
Gets the height of the highest character in a given string. | |
virtual FORCE_INLINE_FUNCTION uint16_t | getMinimumTextHeight() const |
Returns the minimum height needed for a text field that uses this font. | |
virtual uint16_t | getNumberOfLines(const Unicode::UnicodeChar * text, ... ) const |
Count the number of lines in a given text. | |
virtual uint8_t | getSpacingAbove(const Unicode::UnicodeChar * text, ... ) const |
Gets the number of blank pixels at the top of the given text. | |
virtual uint16_t | getStringWidth(const Unicode::UnicodeChar * text, ... ) const |
Gets the width in pixels of the specified string. | |
virtual uint16_t | getStringWidth(TextDirection textDirection, const Unicode::UnicodeChar * text, ... ) const |
Gets the width in pixels of the specified string. | |
virtual | ~Font() |
Finalizes an instance of the Font class. | |
FORCE_INLINE_FUNCTION bool | isInvisibleZeroWidth(Unicode::UnicodeChar character) |
Query if 'character' is invisible, zero width. | |
Protected Functions inherited from Font
Font(uint16_t height, uint8_t pixBelowBase, uint8_t bitsPerPixel, uint8_t byteAlignRow, uint8_t maxLeft, uint8_t maxRight, const Unicode::UnicodeChar fallbackChar, const Unicode::UnicodeChar ellipsisChar) | |
Initializes a new instance of the Font class. | |
uint16_t | getStringWidthLTR(TextDirection textDirection, const Unicode::UnicodeChar * text, va_list pArg) const |
Gets the width in pixels of the specified string. | |
uint16_t | getStringWidthRTL(TextDirection textDirection, const Unicode::UnicodeChar * text, va_list pArg) const |
Gets the width in pixels of the specified string. | |
Protected Attributes inherited from Font
uint8_t | bAlignRow |
The glyphs are saved with each row byte aligned. | |
uint8_t | bPerPixel |
The number of bits per pixel. | |
Unicode::UnicodeChar | ellipsisCharacter |
The ellipsis character used for truncating long texts. | |
Unicode::UnicodeChar | fallbackCharacter |
The fallback character to use when no glyph exists for the wanted character. | |
uint16_t | fontHeight |
The font height in pixels. | |
uint8_t | maxPixelsLeft |
The maximum number of pixels a glyph extends to the left. | |
uint8_t | maxPixelsRight |
The maximum number of pixels a glyph extends to the right. | |
uint8_t | pixelsBelowBaseline |
The number of pixels below the base line. | |
Public Functions Documentation
ConstFont
ConstFont | ( | const GlyphNode * | list , | ||
uint16_t | size , | ||||
uint16_t | height , | ||||
uint8_t | pixBelowBase , | ||||
uint8_t | bitsPerPixel , | ||||
uint8_t | byteAlignRow , | ||||
uint8_t | maxLeft , | ||||
uint8_t | maxRight , | ||||
const Unicode::UnicodeChar | fallbackChar , | ||||
const Unicode::UnicodeChar | ellipsisChar | ||||
) |
Initializes a new instance of the ConstFont class.
list | The array of glyphs known to this font. |
size | The number of glyphs in list. |
height | The height in pixels of the highest character in this font. |
pixBelowBase | The maximum number of pixels that can be drawn below the baseline in this font. |
bitsPerPixel | The number of bits per pixel in this font. |
byteAlignRow | The glyphs are saved with each row byte aligned. |
maxLeft | The maximum a character extends to the left. |
maxRight | The maximum a character extends to the right. |
fallbackChar | The fallback character for the typography in case no glyph is available. |
ellipsisChar | The ellipsis character used for truncating long texts. |
find
const GlyphNode * find | ( | Unicode::UnicodeChar | unicode | ) | |
Finds the glyph data associated with the specified unicode.
unicode | The character to look up. |
A pointer to the glyph node or null if the glyph was not found.
getGlyph
const GlyphNode * getGlyph | ( | Unicode::UnicodeChar | unicode | ) | |
Gets the glyph data associated with the specified Unicode.
Please note that in case of Thai letters and Arabic letters where diacritics can be placed relative to the previous character(s), please use TextProvider::getNextLigature() instead as it will create a temporary GlyphNode that will be adjusted with respect to X/Y position.
unicode | The character to look up. |
A pointer to the glyph node or null if the glyph was not found.
getGlyph
virtual const GlyphNode * getGlyph | ( | Unicode::UnicodeChar | unicode , | const | |
const uint8_t *& | pixelData , | const | |||
uint8_t & | bitsPerPixel | const | |||
) | const |
Gets the glyph data associated with the specified Unicode.
Please note that in case of Thai letters and Arabic letters where diacritics can be placed relative to the previous character(s), please use TextProvider::getNextLigature() instead as it will create a temporary GlyphNode that will be adjusted with respect to X/Y position.
unicode | The character to look up. |
pixelData | Pointer to the pixel data for the glyph if the glyph is found. This is set by this method. |
bitsPerPixel | Reference where to place the number of bits per pixel. |
A pointer to the glyph node or null if the glyph was not found.
Reimplements: touchgfx::Font::getGlyph
getGlyph
const GlyphNode * getGlyph | ( | Unicode::UnicodeChar | unicode , | ||
const uint8_t *& | pixelData , | ||||
uint8_t & | bitsPerPixel | ||||
) |
Gets the glyph data associated with the specified Unicode.
Please note that in case of Thai letters and Arabic letters where diacritics can be placed relative to the previous character(s), please use TextProvider::getNextLigature() instead as it will create a temporary GlyphNode that will be adjusted with respect to X/Y position.
unicode | The character to look up. |
pixelData | Pointer to the pixel data for the glyph if the glyph is found. This is set by this method. |
bitsPerPixel | Reference where to place the number of bits per pixel. |
A pointer to the glyph node or null if the glyph was not found.
getKerning
virtual int8_t getKerning | ( | Unicode::UnicodeChar | prevChar , | const =0 | |
const GlyphNode * | glyph | const =0 | |||
) | const =0 |
Gets the kerning distance between two characters.
prevChar | The Unicode value of the previous character. |
glyph | the glyph object for the current character. |
The kerning distance between prevChar and glyph char.
Reimplements: touchgfx::Font::getKerning
Reimplemented by: touchgfx::InternalFlashFont::getKerning
getPixelData
virtual const uint8_t * getPixelData | ( | const GlyphNode * | glyph | ) | |
Gets the pixel date associated with this glyph.
glyph | The glyph to get the pixels data from. |
Pointer to the pixel data of this glyph.
Reimplemented by: touchgfx::InternalFlashFont::getPixelData
Protected Attributes Documentation
glyphList
const GlyphNode * glyphList
The list of glyphs.
listSize
uint16_t listSize
The size of the list of glyphs.