Table of Contents

UF Font Format Specification

UF fonts use IFF (Interchange File Format) as container. IFF FORM identifier is "UFNT". Following IFF chunks are defined:

FHDR

This chunk contains global properties of a font like family name, size, etc. Properties are stored as a taglist. A taglist is an array of pairs of 32-bit values. The first value in a pair is property identifier (a tag). The second item of a pair is property value. The taglist ts terminated with (0, 0) pair. Termination may be considered superfluous, as number of tags is implicitly given by the chunk length. However termination allows for direct processing the taglist with utility.library functions. List of defined tags:

Tag NameTag IDDescription
UF_FamilyName0x80000001Value of the tag is a byte offset into STRS chunk. A zero-terminated string starts at this offset. Family name string should be interpreted as ISO-8859-1 encoded.
UF_Size0x80000002Font size in pixels, equal to default line height.
UF_Baseline0x80000003Number of raster lines from text line top to the font baseline.
UF_GlyphCount0x80000004Number of glyphs in the file. Must be equal to size of GMAP chunk divided by 8.
UF_Width0x80000005Presence of this tag implies monospaced font and specifies glyph width in pixels.
UF_Weight0x80000006Font weight as in CSS (400 = normal, 700 = bold).
UF_Italic0x80000007Presence of this tag means italic face. Value is not important.

GLYP

The chunk contains glyph data. Each glyph consists of fixed size structure followed by variable length raster data. The structure contains glyph attributes and is defined as follows:

Field NameSizeC TypeDescription
CodePoint4ULONGUnicode code point (number) of the glyph.
RasterWidth4LONGWidth of glyph raster in pixels.
RasterHeight4LONGHeight of glyph raster in pixels.
Baseline4LONG
LeftBearing4LONG
HorizAdvance4LONG
VertAdvance4LONG
KernGroupLeft2UWORD
KernGroupRight2UWORD

Raster data immediately follow the structure. Each pixel takes one bit. Lines are padded up to 16 pixels boundary (2 bytes). Pad pixels must be zero bits, so drawing engine needs not to perform additional clipping. Glyph raster uses traditional scan direction: horizontal left-to-right, vertical top-to-bottom.

GMAP

STRS

KERN

last updated: April 30, 2017