UF fonts use IFF (Interchange File Format) as container. IFF FORM identifier is "UFNT". Following IFF chunks are defined:
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 Name | Tag ID | Description |
UF_FamilyName | 0x80000001 | Value 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_Size | 0x80000002 | Font size in pixels, equal to default line height. |
UF_Baseline | 0x80000003 | Number of raster lines from text line top to the font baseline. |
UF_GlyphCount | 0x80000004 | Number of glyphs in the file. Must be equal to size of GMAP chunk divided by 8. |
UF_Width | 0x80000005 | Presence of this tag implies monospaced font and specifies glyph width in pixels. |
UF_Weight | 0x80000006 | Font weight as in CSS (400 = normal, 700 = bold). |
UF_Italic | 0x80000007 | Presence of this tag means italic face. Value is not important. |
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 Name | Size | C Type | Description |
CodePoint | 4 | ULONG | Unicode code point (number) of the glyph. |
RasterWidth | 4 | LONG | Width of glyph raster in pixels. |
RasterHeight | 4 | LONG | Height of glyph raster in pixels. |
Baseline | 4 | LONG | |
LeftBearing | 4 | LONG | |
HorizAdvance | 4 | LONG | |
VertAdvance | 4 | LONG | |
KernGroupLeft | 2 | UWORD | |
KernGroupRight | 2 | UWORD |
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.
last updated: April 30, 2017