Log In  

Cart #mfontutil-0 | 2024-02-12 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
2

A custom font utility cartridge. Like #font_snippet operates on fonts drawn as sprites, but:

  1. Supports variable-width font attributes;
  2. Supports copying from fonts to the spritesheet; and
  3. 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:

  1. base width and height are calculated automatically, and sprite 0 values add as padding instead;
  2. sprite pixels in non-zero colors other than 7 contribute to the glyph dimensions, but still not the glyph bitmap; and
  3. 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:

  1. "@font" -- copy from the current custom font.
  2. "@draw" -- draw the active font to the spritesheet; useful for getting the default font.

clearsprs() – clear the spritesheet.

P#141415 2024-02-12 01:56 ( Edited 2024-02-12 12:01)


[Please log in to post a comment]