This document describes the FON file format. The information was obtained in the course of reviewing relevant functions in Mapper2.exe. The names of the structures and their fields used in the program were received from the debugging information in Mapper2.exe.
Fonts from FON files are used for displaying information on the Fallout and Fallout 2 worldmap (according to information provided by Wasteland Ghost). All fonts are non-scalable, raster, and do not contain any anti-aliasing information.
Offset | Size | Type | Block | Description |
---|---|---|---|---|
0x0 | 4 | int | Header | The number of character images in the file. A shorthand notation num is used below.Note: Some characters are not included because they weren't included in the file(s). |
0x4 | 4 | int | The height of the font in points | |
0x8 | 4 | int | The distance between adjacent symbols in points | |
0xC | 4 | FontInfo* | Pointer to an array of structures that describe the characters. Note: This field is only important in the memory of the computer. Inside the file, it has no meaning. |
|
0x10 | 4 | unsigned char* | Pointer to an array of images of each individual character's data. Note: This field is only important in the memory of the computer. Inside the file, it has no meaning. |
|
0x14 | 4 | int | An array of characters descriptors | Symbol 0 width |
0x18 | 4 | int | Symbol 0 position in a block of data | |
0x1C | 4 | int | Symbol 1 width | |
0x20 | 4 | int | Symbol 1 position in a block of data | |
... | ... | ... | ... | |
0x14 + 8 * num | 1 | unsigned char | Characters' images data | |
... | ... | ... |
To work with FON files, mapper2.exe and fallout2.exe use the following structure:
typedef struct { int num; // The number of images of characters in the file int height; // height of the font in points int spacing; // The distance between adjacent symbols at the points FontInfo* info; // Pointer to the array structures, describing characters unsigned char* data; // Pointer to the array structures, describing symbol } Font;
typedef struct { int width; // width character's points int offset; // The image characters in a block of data } FontInfo;
The size of the block of data depicting characters determined as follows:
last = font.num-1; // Index of last character in the font size = font.info[last].offset + (font.info[last].width + 7) / 8 * font.height;
(font.info[last].width + 7) / 8
determined by the number of bytes needed to store information on one line symbol image. Information on the image stored as a symbol bit matrix.
Let's say there is a symbol of the size 8x16 points, which is described as the following block data
00 00 7e 81 a5 81 81 bd 99 81 81 7e 00 00 00 00Bit matrix takes the form of
00 00000000 ........ 00 00000000 ........ 7e 01111110 .######. 81 10000001 #......# a5 10100101 #.#..#.# 81 10000001 #......# 81 10000001 #......# bd ==> 10111101 ==> #.####.# 99 10011001 #..##..# 81 10000001 #......# 81 10000001 #......# 7e 01111110 .######. 00 00000000 ........ 00 00000000 ........ 00 00000000 ........ 00 00000000 ........