SCI/Specifications/Graphics/Font resource

From ScummVM :: Wiki
Jump to navigation Jump to search

The SCI font resource

SCI font resources remained unchanged during the SCI revisions and were still used in SCI32. Their format is relatively straightforward and completely sufficient for any 8 or even 16 bit character table:

Offset Type Meaning
0 16bit integer, little endian encoding Always zero (?)
2 16bit integer, little endian encoding NUMCHAR: Number of characters
4 16bit integer, little endian encoding HEIGHT: Number of pixel lines per text line
6+NR*2 16bit integer, little endian encoding Absolute offset of the character #NR, where 0 <= NR < NUMCHAR


HEIGHT does not affect the height of a character, though- it only tells the interpreter how far to move downwards when displaying a line of text. The characters referenced to starting at offset 6 are encoded as follows:

Offset Type Meaning
0 unsigned 8 bit integer character HEIGHT
1 unsigned 8 bit integer character WIDTH
2... bitmask, size HEIGHT * round up(WIDTH / 8) Bitmask for the character


The bitmap consists of HEIGHT lines of n bytes, where n equals the number of bytes required for storing WIDTH bits. Data is stored with the MSB first, in little-endian encoding (first byte describes the 8 leftmost pixels), where a pixel is drawn if the bit it corresponds to is set.