llasram [Lexaloffle Blog Feed]https://www.lexaloffle.com/bbs/?uid=90279 mfont custom font utility cartridge <p> <table><tr><td> <a href="/bbs/?pid=141415#p"> <img src="/bbs/thumbs/pico8_mfontutil-0.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=141415#p"> mfontutil</a><br><br> by <a href="/bbs/?uid=90279"> llasram</a> <br><br><br> <a href="/bbs/?pid=141415#p"> [Click to Play]</a> </td></tr></table> </p> <p>A custom font utility cartridge. Like #font_snippet operates on fonts drawn as sprites, but:</p> <ol> <li>Supports variable-width font attributes;</li> <li>Supports copying from fonts to the spritesheet; and</li> <li>Provides utility command functions meant to be run from the pico-8 prompt.</li> </ol> <p>The command functions are:</p> <p><code>democfont()</code> &ndash; load the custom font from the spritesheet and print demo text using it.</p> <p><code>loadfont()</code> - 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:</p> <ol> <li>base width and height are calculated automatically, and sprite 0 values <em>add</em> as padding instead;</li> <li>sprite pixels in non-zero colors other than 7 contribute to the glyph dimensions, but still not the glyph bitmap; and</li> <li>sprite flag 3 toggles the 1-pixel per-glyph vertical offset.</li> </ol> <p><code>clipfont()</code> &ndash; copy the current custom font into in a clipboard snippet.</p> <p><code>savesprs(fn)</code> &ndash; save the spritesheet to the file at <code>fn</code>, overwriting any existing content in <code>fn</code>.</p> <p><code>loadsprs(fn)</code> &ndash; load the spritesheet from the file at <code>fn</code>, overwriting existing sprites; accepts some special names:</p> <ol> <li><code>&quot;@font&quot;</code> -- copy from the current custom font.</li> <li><code>&quot;@draw&quot;</code> -- draw the active font to the spritesheet; useful for getting the default font.</li> </ol> <p><code>clearsprs()</code> &ndash; clear the spritesheet.</p> https://www.lexaloffle.com/bbs/?tid=140172 https://www.lexaloffle.com/bbs/?tid=140172 Mon, 12 Feb 2024 01:56:03 UTC