SAGA/Datafiles/Bitmap Font

From ScummVM :: Wiki
Jump to navigation Jump to search

SAGA Bitmap Font Format

Resources R#0, R#1, and R#3 are bitmap font resources.

R#3 is the small game font, R#1 is the medium game font (used for character dialogue) and R#2 is a large, "weather-worn" font that is apparently unused in the game.

Bitmap font resources begin with a header.

ITE_FONTHEADER

Type Order Name Description
INT16 LE c_height Maximum character height
INT16 LE c_width Maximum character width
INT16 LE row_length Font data row length (in bytes)

Next follows a table of 256 of the following:

Type Order Name Description
INT16 LE index Byte index into character data

Followed by a table of 256 of the following:

Type Order Name Description
BYTE LE width Character width

Followed by a table of 256 of the following:

Type Order Name Description
BYTE LE flag Unknown character flag (either 0 or 1)

Followed by a table of 256 of the following:

Type Order Name Description
BYTE LE tracking Character tracking value

Followed by a block of (row_length * c_height) bytes of font data.

If char *font_data points to the beginning of the font data block, then the following formula will access the data for a particular character:

font_data + (row_length * y)

where y is the row value; each character has c_height rows. Each character is ((width - 1) / 8) + 1 bytes wide. A set bit corresponds to a set pixel.