|
idfxx 1.0.0
Modern C++23 components for ESP-IDF
|
A fixed-cell monochrome bitmap font. More...
Public Member Functions | |
| constexpr size_t | bytes_per_row () const noexcept |
| Returns the number of bytes in one glyph row. | |
| constexpr size_t | bytes_per_glyph () const noexcept |
| Returns the number of bytes in one glyph. | |
| constexpr bool | contains (char c) const noexcept |
Returns true if the font has a glyph for c. | |
| constexpr const uint8_t * | glyph (char c) const noexcept |
Returns a pointer to the glyph bitmap for c. | |
| constexpr bool | ink_at (char c, size_t col, size_t row) const noexcept |
Returns true if the glyph for c has ink at (col, row). | |
| constexpr size_t | advance (char) const noexcept |
Returns the horizontal distance the cursor moves after c. | |
Public Attributes | |
| uint8_t | width |
| Glyph cell width in pixels. | |
| uint8_t | height |
| Glyph cell height in pixels. | |
| char | first_char |
| First character in the glyph range. | |
| char | last_char |
| Last character in the glyph range (inclusive). | |
| const uint8_t * | bitmap |
| Glyph data (see struct description for layout). | |
A fixed-cell monochrome bitmap font.
Glyphs cover a contiguous character range and share one cell size. The bitmap stores glyphs consecutively, each as height rows of ceil(width / 8) bytes, MSB = leftmost pixel.
|
inlineconstexprnoexcept |
Returns the horizontal distance the cursor moves after c.
In a fixed-cell font every character advances one cell width, including characters outside the glyph range (rendered blank).
| c | The character. |
Definition at line 90 of file font.hpp.
References width.
Referenced by idfxx::gfx::draw_text(), and idfxx::font::text_width().
|
inlineconstexprnoexcept |
Returns the number of bytes in one glyph.
Definition at line 52 of file font.hpp.
References bytes_per_row(), and height.
Referenced by glyph().
|
inlineconstexprnoexcept |
Returns the number of bytes in one glyph row.
Definition at line 49 of file font.hpp.
References width.
Referenced by bytes_per_glyph(), idfxx::gfx::draw_text(), and ink_at().
|
inlineconstexprnoexcept |
Returns true if the font has a glyph for c.
Definition at line 55 of file font.hpp.
References first_char, and last_char.
Referenced by idfxx::gfx::draw_text().
|
inlineconstexprnoexcept |
Returns a pointer to the glyph bitmap for c.
| c | A character satisfying contains. |
Definition at line 62 of file font.hpp.
References bitmap, bytes_per_glyph(), and first_char.
Referenced by idfxx::gfx::draw_text(), and ink_at().
|
inlineconstexprnoexcept |
Returns true if the glyph for c has ink at (col, row).
Per-pixel accessor decoding the glyph bitmap layout, so consumers need not address the packed bytes themselves.
| c | A character satisfying contains. |
| col | Column within the glyph cell, in [0, width). |
| row | Row within the glyph cell, in [0, height). |
Definition at line 77 of file font.hpp.
References bytes_per_row(), and glyph().
| const uint8_t* idfxx::font::mono_font::bitmap |
| char idfxx::font::mono_font::first_char |
First character in the glyph range.
Definition at line 44 of file font.hpp.
Referenced by contains(), and glyph().
| uint8_t idfxx::font::mono_font::height |
Glyph cell height in pixels.
Definition at line 43 of file font.hpp.
Referenced by bytes_per_glyph(), and idfxx::gfx::draw_text().
| char idfxx::font::mono_font::last_char |
Last character in the glyph range (inclusive).
Definition at line 45 of file font.hpp.
Referenced by contains().
| uint8_t idfxx::font::mono_font::width |
Glyph cell width in pixels.
Definition at line 42 of file font.hpp.
Referenced by advance(), bytes_per_row(), and idfxx::gfx::draw_text().