62 [[nodiscard]]
constexpr const uint8_t*
glyph(
char c)
const noexcept {
77 [[nodiscard]]
constexpr bool ink_at(
char c,
size_t col,
size_t row)
const noexcept {
90 [[nodiscard]]
constexpr size_t advance(
char )
const noexcept {
return width; }
104[[nodiscard]]
constexpr size_t text_width(
const mono_font& font, std::string_view text,
unsigned scale = 1) noexcept {
109 for (
char c : text) {
112 return width * scale;
constexpr size_t text_width(const mono_font &font, std::string_view text, unsigned scale=1) noexcept
Returns the width in pixels of text rendered in font.
Bitmap font types, text metrics, and bundled fonts.
A fixed-cell monochrome bitmap font.
char first_char
First character in the glyph range.
const uint8_t * bitmap
Glyph data (see struct description for layout).
constexpr size_t advance(char) const noexcept
Returns the horizontal distance the cursor moves after 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).
uint8_t width
Glyph cell width in pixels.
constexpr size_t bytes_per_glyph() const noexcept
Returns the number of bytes in one glyph.
constexpr size_t bytes_per_row() const noexcept
Returns the number of bytes in one glyph row.
constexpr bool contains(char c) const noexcept
Returns true if the font has a glyph for c.
char last_char
Last character in the glyph range (inclusive).
uint8_t height
Glyph cell height in pixels.