Pixel-art text — render strings as scaled bitmap glyphs onto a canvas.
A font is a table of monochrome glyph bitmaps (rows of #/.) with a fixed
cell size.
Each glyph is baked once into a white alpha-mask sprite (cached per
character + scale) and blitted with the draw colour folded in as a tint, so
the same cached mask renders in any colour without re-rasterizing.
This builds directly on term.gfx.sprite (art masks)
and canvas:blit (tinted compositing).
| Name | Signature |
|---|---|
| font | font(spec) -> font |
font(
spec) ->font
Create a pixel-art font
spec table field | default | description |
|---|---|---|
glyphs | map char -> bitmap rows of #/. | |
cell_w/cell_h | glyph cell size in pixels | |
default_color | RGBA, default near-white | |
fallback | | char to draw for missing glyphs, default space |
spacing | 1 | gap between glyphs in source pixels |
line_spacing | 1 | gap between lines in source pixels |
With no glyphs, the bundled default 5x7 ASCII font is used.
Lowercase letters fall back to their uppercase glyph.