A custom font utility cartridge. Like #font_snippet operates on fonts drawn as sprites, but:
- Supports variable-width font attributes;
- Supports copying from fonts to the spritesheet; and
- Provides utility command functions meant to be run from the pico-8 prompt.
The command functions are:
democfont()
– load the custom font from the spritesheet and print demo text using it.
loadfont()
- load the custom font from the spritesheet. Only pixels with color 7 transfer. Sprite 0 sets base font attributes: one row per attribute byte. A font is made variable-width by setting pixel (0, 5), in which case:
- base width and height are calculated automatically, and sprite 0 values add as padding instead;
- sprite pixels in non-zero colors other than 7 contribute to the glyph dimensions, but still not the glyph bitmap; and
- sprite flag 3 toggles the 1-pixel per-glyph vertical offset.
clipfont()
– copy the current custom font into in a clipboard snippet.
savesprs(fn)
– save the spritesheet to the file at fn
, overwriting any existing content in fn
.
loadsprs(fn)
– load the spritesheet from the file at fn
, overwriting existing sprites; accepts some special names:
"@font"
-- copy from the current custom font."@draw"
-- draw the active font to the spritesheet; useful for getting the default font.
clearsprs()
– clear the spritesheet.
[Please log in to post a comment]