contains font rendering structures both for AdafruitGFX fonts and TcUnicode fonts More...
Go to the source code of this file.
Classes | |
struct | GFXglyph |
struct | GFXfont |
struct | UnicodeFontGlyph |
struct | UnicodeFontBlock |
struct | UnicodeFont |
Typedefs | |
typedef uint32_t | bitmap_size_t |
Enumerations | |
enum | BitmapFormat : uint8_t { TCFONT_ONE_BIT_PER_PIXEL } |
contains font rendering structures both for AdafruitGFX fonts and TcUnicode fonts
struct GFXglyph |
The adafruit font glyph format, each letter in the font is represented by a GFXglyph in an array. This indicates how to read the bitmap and process it, the width and height are related to the bitmap, but the bitmap may not take up the full area, the xAdvance is how far to move in the x dimension after rendering the bitmap, the x and y offsets tell the renderer where to start drawing the bit. With these fonts, the y start point is always the baseline.
struct GFXfont |
This represents an adafruit font, it holds the bitmap data for all glyphs, and also includes and array of glyphs, these are sequential characters from first through to last. Lastly, the yAdvance indicates how far to go for a new line.
Class Members | ||
---|---|---|
uint8_t * | bitmap | Glyph bitmaps, concatenated. |
uint16_t | first | ASCII extents (first char) |
GFXglyph * | glyph | Glyph array. |
uint16_t | last | ASCII extents (last char) |
uint8_t | yAdvance | Newline distance (y axis) |
struct UnicodeFontGlyph |
The TcUnicode glyph format is very similar to the adafruit glyph format, other than some small differences to make unicode handling easier. The biggest difference is the relativeChar support, so it is possible to skip parts of a font that are not needed. This char code is relative to the unicode block. The bit map offset has been adjusted to 17 bits, to allow each block to have 128K of bitmaps.
This glyph data indicates how to read the bitmap and process it, the width and height are related to the bitmap, but the bitmap may not take up the full area, the xAdvance is how far to move in the x dimension after rendering the bitmap, the x and y offsets tell the renderer where to start drawing the bit. With these fonts, the y start point is always the baseline.
struct UnicodeFontBlock |
A unicode block is a range of character akin to a code page. In this structure we store the bitmaps and glyphs that are associated with the block range. This allows us to be more efficient with memory overall. The char nums in a glyph are actually calculated by startingId + charNum
Class Members | ||
---|---|---|
const uint8_t * | bitmap |
the array of bitmaps for each letter |
const UnicodeFontGlyph * | glyphs |
The glyphs within this block |
uint16_t | numberOfPoints |
The number of points in this block |
uint32_t | startingNum |
The starting point for this block, all glyph entries are an offset from this |
struct UnicodeFont |
This represents the whole font, and is passed to an TcUnicode renderer requiring a font. It is basically an array of blocks sorted by starting code in reverse order. It also has instructions on how to process the bitmap structure for future improvements, and the yAdvance.
Class Members | ||
---|---|---|
BitmapFormat | bitmapFormat | |
uint16_t | numberOfBlocks |
the number of items |
const UnicodeFontBlock * | unicodeBlocks |
the array of unicode glyphs |
uint8_t | yAdvance |
the height of each line |
enum BitmapFormat : uint8_t |
Indicates how to read the pixel map within the font. In future I plan to support at least four greyscale levels which allows basic anti-aliasing, and if thre is demand fonts with multiple palette colours, but at the moment only one bit per pixel is supported.