|
TinyGPU
|
Fixed-size 5x7 bitmap font with ASCII and extended character support. More...
#include <Font5x7.h>


Public Types | |
| using | Glyph = typename Base::Glyph |
| using | CodePoint = typename Base::CodePoint |
Public Types inherited from BitmapFont< Width, Height, RowT, RGB_T > | |
| using | Glyph = std::array< RowT, Height > |
| Glyph storage: one row entry per pixel row. | |
| using | CodePoint = uint32_t |
| Unicode code point type used during UTF-8 decoding. | |
Public Member Functions | |
| Font5x7 () | |
| Creates a Font5x7 instance. | |
| const Glyph & | glyph (CodePoint codePoint) const override |
| const Glyph & | glyph (char character) const |
| Returns the glyph for an 8-bit character. | |
| virtual const Glyph & | glyph (CodePoint codePoint) const |
Public Member Functions inherited from BitmapFont< Width, Height, RowT, RGB_T > | |
| BitmapFont (const Glyph *table, size_t glyphCount, char firstChar=' ') | |
| Creates a fixed bitmap font over a contiguous glyph table. | |
| void | setProportional (bool proportional) override |
| bool | isProportional () const override |
| Returns whether proportional spacing is enabled. | |
| uint8_t | glyphLeftOffset (CodePoint codePoint) const |
| uint8_t | glyphEffectiveWidth (CodePoint codePoint) const |
| uint8_t | glyphAdvanceWidth (CodePoint codePoint) const |
| const Glyph & | glyph (char character) const |
| Returns the glyph for an 8-bit character. | |
| virtual const Glyph & | glyph (CodePoint codePoint) const |
| bool | pixel (CodePoint codePoint, uint8_t x, uint8_t y) const |
| Returns whether a pixel is set in a code point glyph. | |
| void | drawCodePoint (ISurface< RGB_T > &target, int16_t x, int16_t y, CodePoint codePoint, RGB_T foreground, RGB_T background=RGB_T(0), bool opaque=false, uint8_t scale=1) const |
| void | drawChar (ISurface< RGB_T > &target, int16_t x, int16_t y, char character, RGB_T foreground, RGB_T background=RGB_T(0), bool opaque=false, uint8_t scale=1) const |
| Draws a single character. | |
| void | drawText (ISurface< RGB_T > &target, int16_t x, int16_t y, const char *text, RGB_T foreground, RGB_T background=RGB_T(0), bool opaque=false, uint8_t scale=1, uint8_t spacing=1, uint8_t lineSpacing=1) const override |
| Draws a UTF-8 text string. | |
| size_t | measureTextWidth (const char *text, uint8_t scale=1, uint8_t spacing=1) const override |
| Returns the width of the longest text line in pixels. | |
| size_t | measureTextHeight (const char *text, uint8_t scale=1, uint8_t lineSpacing=1) const override |
| Returns the total text height in pixels. | |
| size_t | getHeight (uint8_t scale) const override |
| Returns the scaled glyph height in pixels. | |
Public Member Functions inherited from IFont< RGB_T > | |
| virtual | ~IFont ()=default |
| Destroys the font interface. | |
| virtual void | drawText (ISurface< RGB_T > &target, int16_t x, int16_t y, const char *text, RGB_T foreground, RGB_T background, bool opaque=false, uint8_t scale=1, uint8_t spacing=1, uint8_t lineSpacing=1) const =0 |
| Draws a text string onto a framebuffer target. | |
| virtual size_t | measureTextWidth (const char *text, uint8_t scale=1, uint8_t spacing=1) const =0 |
| Returns the width of the longest text line in pixels. | |
| virtual size_t | measureTextHeight (const char *text, uint8_t scale=1, uint8_t lineSpacing=1) const =0 |
| Returns the total text height in pixels. | |
| virtual size_t | getHeight (uint8_t scale) const =0 |
| Returns the scaled glyph height in pixels. | |
| virtual void | setProportional (bool proportional) |
| virtual bool | isProportional () const |
| Returns whether proportional spacing is enabled. | |
Static Public Attributes | |
| static constexpr char | kFirstChar = ' ' |
| First directly stored ASCII character. | |
| static constexpr char | kLastChar = '~' |
| Last directly stored ASCII character. | |
Static Public Attributes inherited from BitmapFont< Width, Height, RowT, RGB_T > | |
| static constexpr uint8_t | kGlyphWidth = Width |
| Width of a glyph in pixels. | |
| static constexpr uint8_t | kGlyphHeight = Height |
| Height of a glyph in pixels. | |
| static constexpr uint8_t | kBlankGlyphWidth = (kGlyphWidth > 2) ? kGlyphWidth - 2 : kGlyphWidth |
Fixed-size 5x7 bitmap font with ASCII and extended character support.
Built on BitmapFont<5, 7, uint8_t, RGB_T> for glyph storage, pixel lookup, drawing, and text measurement - this class only adds its own built-in glyph table (the 95 printable ASCII characters) and a fallback lookup for codepoints outside that contiguous range (Latin-1/CP1252-ish accented/currency/symbol characters, mapped either to a purpose-built glyph or to the closest plain ASCII character), by overriding glyph().
| using CodePoint = typename Base::CodePoint |
| using Glyph = typename Base::Glyph |
|
inline |
Returns the glyph for an 8-bit character.
Returns the glyph for a Unicode code point. Virtual so a subclass with its own extra fallback logic (e.g. Font5x7's mapping of Latin-1/CP1252-ish codepoints outside its stored ASCII range) can override just this lookup and get every other method here - pixel(), drawText(), measureTextWidth(), ... - for free, since they all call glyph() internally rather than duplicating the lookup themselves.
Reimplemented from BitmapFont< Width, Height, RowT, RGB_T >.
Returns the glyph for a Unicode code point: the built-in extended mapping (see glyphForExtendedCodePoint()) for codepoints outside the directly-stored ASCII range, otherwise Base's own table lookup (which itself falls back to '?' for anything unmapped).
Reimplemented from BitmapFont< Width, Height, RowT, RGB_T >.
|
staticconstexpr |
First directly stored ASCII character.
|
staticconstexpr |
Last directly stored ASCII character.