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
:
@draw-uf2 ( text* -- ) [ LIT2 15 -Screen/auto ] DEO &>while ( -- ) LDAk #20 SUB #00 SWP ( addr ) DUP2 #50 SFT2 ;font/glyphs ADD2 .Screen/addr DEO2 ( move ) ;font ADD2 LDA #00 SWP .Screen/x DEI2 ADD2 ( draw ) [ LIT2 01 -Screen/sprite ] DEOk DEO .Screen/x DEO2 INC2 LDAk ?&>while POP2 JMP2r
The empty pixel data of the first 32 invisible characters are typically removed. You will find this filetype in the Uxn ecosystem, namely in Left. Uf2 fonts can be viewed and edited with Turye.