
UFX is a proportional font format.
The UFX
file begins with 256 bytes corresponding to the width(in
pixels) of each of the 256 glyphs in the spritesheet, followed by the pixel
data in the .icn format for each character.
Extension | Size(px) | Filesize |
---|---|---|
.uf1 | 8x8(1 tile) | 0x0900 |
.uf2 | 16x16(4 tiles) | 0x2100 |
.uf3 | 24x24(9 tiles) | 0x4900 |
The pixel data for each glyph is stored in a series of 8x8 tiles, the drawing order goes vertically as to be able to skip extra draw calls for narrow characters if needed:
0 | 2 |
1 | 3 |
A naive uf2 character drawing routine in Uxntal is
about 50 bytes, with the screen's auto byte set to
#15
:
@uf2/<draw> ( text* -- ) [ LIT2 15 -Screen/auto ] DEO [ LIT2r 05 -Screen/sprite ] &>while LDAk DUP ?{ POP POP2 POP2r JMP2r } #0000 ROT ( addr ) DUP2 #50 SFT2 ;&glyphs ADD2 .Screen/addr DEO2 ( move ) ;&widths ADD2 LDA .Screen/x DEI2 ADD2 ( draw ) [ DEOkr DEOkr ] .Screen/x DEO2 INC2 !&>while
Note that the pixel data of the first 32 invisible characters are typically
removed with #20 SUB
. You will find this filetype in the Uxn ecosystem, namely in Left. Uf2
fonts can be viewed and edited with Turye.
- Complete example, Uxntal