XXIIVV
Proportional Fonts in Uxn
Proportional Fonts in Uxn

UFX is a 1-bit proportional font format for the Uxn system.

The UF* file begins with 256 bytes corresponding to the width of each of the 255 characters in the font (in pixels), followed by the pixel data in the .icn format for each character.

ExtensionSize(px)Filesize
.uf18x8(1 tile)0x0900
.uf216x16(4 tiles)0x2100
.uf324x24(9 tiles)0x4900

You will find this filetype in the Uxn ecosystem, namely in Left. Uf2 fonts can be viewed and edited with Turye. The drawing order goes vertically as to be able to skip 2 draw calls for narrow characters:

02
13

Draw a character's glyph in Uxntal is less than 80 bytes when the screen's auto byte is set to auto-y and auto-addr:

%GET-WIDTH { TOS ;font ++ LDA }
%GET-GLYPH { TOS #50 SFT2 ;font/glyphs ++ }

@draw-ufx ( char color -- )

	.Screen/x DEI2 STH2 
	.Screen/y DEI2 STH2 
	( glyph ) OVR GET-GLYPH .Screen/addr DEO2
	DUP .Screen/sprite DEOk DEO 
	STH2kr .Screen/y DEO2
	SWP GET-WIDTH 
	DUP #09 < ,&narrow JCN
		.Screen/x DEI2k #0008 ++ ROT DEO2
		OVR .Screen/sprite DEOk DEO 
		STH2kr .Screen/y DEO2
		&narrow
	POP2r
	( width ) TOS STH2r ++ .Screen/x DEO2
	POP

RTN