std :: gui::gui_font
Struct std::GuiFont
struct GuiFont {
int glyphW;
int glyphH;
int first;
int count;
&heap unsigned char bitmap;
}Fields
first codepoint this font covers
number of glyphs (codepoints first..first+count-1)
count * bytesPerGlyph(glyphW,glyphH) bytes
Methods
Allocates a blank (all-zero) font of the given shape, ready for set_bit() calls to draw each glyph programmatically.
A heap-owned copy of the built-in 8x8 font (see gui_draw.sc), in the same generic GuiFont representation — e.g. as a starting point to edit with set_bit() and save a modified variant. Release it with free().
Bit accessors, (0,0) = top-left of the glyph for codepoint 'cp'. Reads return 0 for an out-of-range codepoint or pixel; writes are a no-op in that case.
Serialization. save() writes this font as an SCXF file; load() reads one into this font in place (overwriting it without freeing — call it on a fresh 'struct GuiFont f;', or free() first). On failure load() leaves the font untouched. Both return 1 = ok.
= drop()
int draw_text(
&GuiWindow win,
int x,
int y,
const &char text,
struct GuiColor color,
int scale,
) constsource · definitionDrawing with this font (mirrors GuiWindow::draw_text() and gui_draw.h's gui_text_width()/gui_text_height() for the built-in font): each glyph cell is glyphWscale by glyphHscale pixels; codepoints the font doesn't cover draw as a blank cell. draw_text() returns the total pixel width drawn.