XXIIVV
Proportional Fonts in Uxn
Proportional Fonts in Uxn

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.

ExtensionSize(px)Filesize
.uf18x8(1 tile)0x0900
.uf216x16(4 tiles)0x2100
.uf324x24(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:

02
13

A naive uf2 character drawing routine in Uxntal is about 50 bytes, with the screen's auto byte set to #15:

@draw-uf2 ( text* -- )

	#15 .Screen/auto DEO
	&while
		LDAk #20 SUB #00 SWP
			DUP2 #50 SFT2 ;font/glyphs ADD2 .Screen/addr DEO2
			;font ADD2 LDA #00 SWP .Screen/x DEI2 ADD2
		#01 .Screen/sprite DEOk DEO
		.Screen/x DEO2
		INC2 LDAk ,&while JCN
	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.

incoming turye adelie potato