SIRTX Font format

Information on the SIRTX Font format

The SIRTX Font format is used as a native format for pixel (bitmap) fonts. It provides support for full Unicode range of characters, up to 64 thousand glyphs, with a maximum size of 255 by 255 pixels.

The font files are divided in four blocks. The magic, the header, the character map, and the glyph data. The magic is used to identify the format and it's version. The header includes the glyph geometry and count. The character map maps Unicode code points to specific glyphs. And the glyph data contains the actual bitmaps. All but the glyph data is 8 byte aligned. All data in the format is in network byte order (big endian).

The file magic is a string of eight bytes: 0x00, 0x07, 0x53 ("S"), 0x46 ("F"), 0x0d ("\r"), 0x0a ("\n"), 0xc0, 0x0a ("\n"). This magic is fixed for all files of this type.

The header consists of 8 bytes with the following meanings:

Offset † Size [Byte] Description
0 2 Data start marker, always 0x0600
2 1 Glyph width in pixel. A value of zero is invalid
3 1 Glyph height in pixel. A value of zero is invalid
4 1 Glyph bit depth in bit. Only allowed value is 1
5 1 Reserved, must be zero
6 2 Number of glyphs

†: Relative to header. Add eight for offset relative to file.

The character map is a list of eight byte long code point runs. Each run consists of the start code point, the length, and the first entry in the glyph data, The last run is marked to signal the end of the map. This is done by setting the start value to all ones. It is valid that multiple characters map to the same glyph. Each run is encoded as follows:

Offset † Size [Byte] Description
0 4 The start code point. The last run uses the value of all ones.
4 2 The length of the run minus one. If the run is only one character long a value of zero is encoded.
6 2 The first entry into the glyph data (corresponding to the start code point). If length is non-zero each additional n-th code point is mapped to the n-th next glyph.

†: Relative to current run.

The glyph data is encoded in accordance with the bit depth value from the header. For a bit depth of one the glyph data is encoded as one bit per pixel. The leftmost pixel is encoded as MSB. Each row is padded with zeros to the next full byte. This format is the same as the WBMP Type 0 image data. See the WAP WAE Specification (version 1.1, 24-May-1999) section 6 and appendix A for details.

9201 (* 0) "SIRTX Font format" ~>