FNT File Format

From OpenDeathValley
Jump to: navigation, search


General

Specifications

struct fnt_header
for fnt_header.nb_entry{
    struct char_entry
}
struct img_fnt image_00
struct img_fnt image_01

FNT Header

+0x00:    SIGNATURE     [BYTE] * 6
+0x06:    UNK_DWORD_00  [DWORD]
+0x0A:    FONT_NAME     [BYTE] * 36
+0x2E:    UNK_WORD_00   [WORD]     // TYPE SOMETHING ?
+0x30:    UNK_WORD_01   [WORD]
+0x32:    UNK_DWORD_02  [DWORD]    // HEIGHT ?
+0x36:    UNK_DWORD_03  [DWORD]    // Width rectangle letter
+0x3A:    UNK_DWORD_04  [DWORD]    // Maximum width letter
+0x3E:    NB_ENTRY      [DWORD]
if UNK_DWORD_00 >= 0x200:
  +0x42:  UNK_DWORD_05  [DWORD]    // X_COORD + UNK_DWORD_05 ?
end
  • Signature must be equal to "SBFONT"

Char Entry

+0x00:    CHAR_VALUE     [WORD]
+0x02:    Y_COORD        [DWORD]
+0x06:    WIDTH_LETTER   [DWORD]
+0x0A:    UNK_DWORD_00   [DWORD]
+0x0E:    UNK_DWORD_01   [DWORD]
  • The "real" witdh is computed: WIDTH_LETTER + UNK_DWORD_00 + UNK_DWORD_01

IMG fnt

R5G6B5 bzip2 compressed image

+0x00:    WIDTH             [WORD]
+0x02:    HEIGHT            [WORD]
+0x04:    TYPE_COMPRESSION  [DWORD]
+0x08:    SIZE_COMPRESSED   [DWORD]
+0x0C:    DATA_COMPRESSED   [BYTE] * SIZE_COMPRESSED

TYPE_COMPRESSION

  • 0x01: zlib compression, R5G6B5
  • 0x02: bz2 compression, R5G6B5

ALL FNT

Go fullscreen!

Example (buttons_0.fnt and tooltips.fnt)

[+] fnt_filename = .\buttons_0.fnt
[+] first_unk_dword_00 = 0x00000200
[+] name = PlugCapsSSK
[+] unk_word_00 = 0000 (0)  // TYPE SOMETHING ?
[+] unk_word_01 = 0000 (0)
[+] unk_dword_02 = 00000021 (33)  // HEIGHT ?
[+] unk_dword_03 = 0000001C (28)  // Width square letter
[+] unk_dword_04 = 00000017 (23)  // Max width letter
0000  74 00 00 00                                       t...
[+] nb_entry = 0x00000074
[+] unk_dword_05 = FFFFFFFD (4294967293)
[+] num = 0000
[+] char_value = 0x0020 (" ")
[+] Y_COORD = 0x00000000
[+] WIDTH_LETTER = 0x00000005
[+] unk_dword_00 = 0x00000000
[+] unk_dword_01 = 0x00000002
[+] num = 0001
[+] char_value = 0x0021 ("!")
[+] Y_COORD = 0x0000001D
[+] WIDTH_LETTER = 0x00000008
[+] unk_dword_00 = 0x00000001
[+] unk_dword_01 = 0x00000001

--------------------

[+] fnt_filename = .\tooltips.fnt
[+] first_unk_dword_00 = 0x00000200
[+] name = Lydian
[+] unk_word_00 = 0002 (2)  // TYPE SOMETHING ?
[+] unk_word_01 = 0000 (0)
[+] unk_dword_02 = 00000013 (19)  // HEIGHT ?
[+] unk_dword_03 = 0000000F (15)  // Width square letter
[+] unk_dword_04 = 0000000C (12)  // Max width letter
0000  a2 00 00 00                                       ....
[+] nb_entry = 0x000000A2
[+] unk_dword_05 = FFFFFFFE (4294967294)
[+] num = 0000
[+] char_value = 0x0020 (" ")
[+] Y_COORD = 0x00000000
[+] WIDTH_LETTER = 0x00000005
[+] unk_dword_00 = 0x00000000
[+] unk_dword_01 = 0x00000002
[+] num = 0001
[+] char_value = 0x0021 ("!")
[+] Y_COORD = 0x00000010
[+] WIDTH_LETTER = 0x00000006
[+] unk_dword_00 = 0x00000001
[+] unk_dword_01 = 0x00000001

The first image is of type 0x00 (we can guess type 0x00 == letter with a border between them)

The second image is of type 0x02 (we can guess type 0x02 == letter without a border between them)

Go fullscreen!