term.gfx.font — Lilush API

←index

← term.gfx

Overview

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).

Functions

NameSignature
fontfont(spec) -> font

font(spec) -> font

Create a pixel-art font

spec:

With no glyphs, the bundled default 5x7 ASCII font is used. Lowercase letters fall back to their uppercase glyph.