Debug Font - widberg/fmtk GitHub Wiki
The font used to draw some debug views, such as the one associated with the command DisplaySoundInfo
, is not found in a BigFile; instead, it is packed into the executable as an array of bytes representing the pixels of each character. This data can be represented using the following ImHex pattern:
struct Character {
u8 pixels[8 * 8];
};
struct FontDebug_Z {
Character characters[255 - 32];
};
An index in the characters array represents the extended ASCII value of that character minus 32
since the first 32
characters in the extended ASCII range are skipped due to being non-printable control characters; therefore the range of ASCII values represented by the characters array is [32-254]
. Notably, 255
is missing from the range, this is a non-breaking space character and is not printable but no special case is made for it like the other non-printable characters; if one of the non-printable control characters before 32
is in a string to be printed, it is skipped and no space is left for it. The pixel data per character is stored as an 8
by 8
row-major matrix where a value of zero represents a black pixel and a non-zero value represents a white pixel.
The script font_debug.py will produce a font_debug.bmp
file, shown below, from the printable characters in the debug font using the embedded font data dumped from FUEL. In this image, the ASCII value of each character starts at 32
and increases by 1
for each character when read left to right, top to bottom. Only the first 223
characters in this image are actually from the font data, the printable range, the remaining space is left empty to make the image square. The image should be viewed with nearest-neighbor sampling to look as close to how it does in-game as possible.