FastArduino v1.10
C++ library to build fast but small Arduino/AVR projects
|
Generic font support class. More...
#include <fastarduino/devices/font.h>
Public Member Functions | |
constexpr | Font (char first_char, char last_char, uint8_t width, uint8_t height, const uint8_t *glyphs) |
Construct a new Font. More... | |
uint8_t | width () const |
Width of font glyphs in pixels. More... | |
uint8_t | height () const |
Height of font glyphs in pixels. More... | |
uint8_t | first_char () const |
Code of first char supported by this Font. More... | |
uint8_t | last_char () const |
Code of last char supported by this Font. More... | |
uint8_t | glyph_rows () const |
Determine the number of rows this font uses for each of its glyphs. More... | |
uint8_t | glyph_cols () const |
Determine the number of columns this font uses for each of its glyphs. More... | |
uint8_t | glyph_size () const |
Glyph size in bytes. More... | |
uint16_t | get_char_glyph_ref (char value) const |
Get a glyph reference for the requested character value . More... | |
uint8_t | get_char_glyph_byte (uint16_t glyph_ref, uint8_t index) const |
Get one byte of character glyph. More... | |
Static Public Attributes | |
static constexpr bool | VERTICAL = VERTICAL_ |
true if font is vertical, false if horizontal More... | |
Generic font support class.
Font glyphs are either stored horizontally (1 byte represents a row) or vertically (1 byte represents a columns). Direction selection is based on display devices internal raster organisation and is thus used for optimization purposes.
VERTICAL_ | true if font is vertical, false if horizontal |
|
inlineconstexpr |
Construct a new Font.
first_char | code of first character mapped to a glyph |
last_char | code of last character mapped to a glyph |
width | width of a glyph in pixels |
height | height of a glyph in pixels |
glyphs | pointer to an array of bytes containing all glyphs from first_char and last_char ; this array must be stored in MCU flash memory. |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Determine the number of rows this font uses for each of its glyphs.
Result depends on:
For a vertical font, one row is already composed of 8 pixels, hence the result will be 1 for fonts which height is 8 or less. For a horizontal font, the result will be exactly the font height.
|
inline |
Determine the number of columns this font uses for each of its glyphs.
Result depends on:
For a vertical font, one column is one pixel, hence the result will be exactly the font width. For a horizontal font, one column is 8 pixels (one byte), hence the result will be 1 for fonts which width is 8 or less.
|
inline |
|
inline |
Get a glyph reference for the requested character value
.
the char glyph ref object
value | character code to retrieve the glyph for |
get_char_glyph_byte()
; 0
if no glyph exists for value
.
|
inline |
Get one byte of character glyph.
glyph_ref | unique glyph referenced as returned by get_char_glyph_ref() |
index | byte index to retrieve, from 0 to glyph_size() |
VERTICAL
) for glyph_ref
|
staticconstexpr |