FONT (File Format): Difference between revisions
Jump to navigation
Jump to search
>Aruki |
>Aruki No edit summary |
||
| Line 12: | Line 12: | ||
{| class="wikitable" | {| class="wikitable" | ||
! Offset | ! Offset | ||
! Type | |||
! Size | ! Size | ||
! Description | ! Description | ||
|- | |- | ||
| 0x0 | | 0x0 | ||
| char[4] | |||
| 4 | | 4 | ||
| '''"FONT" magic fourCC''' | | '''"FONT" magic fourCC''' | ||
|- | |- | ||
| 0x4 | | 0x4 | ||
| u32 | |||
| 4 | | 4 | ||
| '''Version'''; see below | | '''Version'''; see below | ||
|- | |- | ||
| 0x8 | | 0x8 | ||
| u32 | |||
| 4 | | 4 | ||
| ''' | | {{unknown|'''Unknown'''}} | ||
|- | |- | ||
| 0xC | | 0xC | ||
| s32 | |||
| 4 | | 4 | ||
| ''' | | '''Line height''' | ||
|- | |- | ||
| 0x10 | | 0x10 | ||
| 4 | | 4 | ||
| ''' | | '''Paragraph upper margin''' | ||
|- | |- | ||
| 0x14 | | 0x14 | ||
| 4 | | 4 | ||
| ''' | | '''Line margin''' | ||
|- | |- | ||
| 0x18 | | 0x18 | ||
| Line 127: | Line 132: | ||
| u32 | | u32 | ||
| 4 | | 4 | ||
| ''' | | '''Left padding''' | ||
|- | |- | ||
| 0x16 | | 0x16 | ||
| Line 137: | Line 142: | ||
| u32 | | u32 | ||
| 4 | | 4 | ||
| ''' | | '''Right padding''' | ||
|- | |- | ||
| 0x1E | | 0x1E | ||
| u32 | | u32 | ||
| 4 | | 4 | ||
| ''' | | '''Width''' | ||
|- | |- | ||
| 0x22 | | 0x22 | ||
| u32 | | u32 | ||
| 4 | | 4 | ||
| ''' | | '''Height''' | ||
|- | |- | ||
| 0x26 | | 0x26 | ||
| u32 | | u32 | ||
| 4 | | 4 | ||
| ''' | | '''Base offset''' | ||
|- | |- | ||
| 0x2A | | 0x2A | ||
Revision as of 23:06, 26 March 2015
The FONT format defines fonts that can be used to display text in-game.
| To do: Notate differences between different versions of the format. Only Metroid Prime's FONT version is documented at the moment. Character definition structure should be expanded on; there should be a section explaining what each value does, and it should be made more clear which UV coordinate corresponds to which vertex. |
| This file format needs more research There's some unknowns in the header, and some of the values in the character definition structure should be double-checked. |
Format
Header
| Offset | Type | Size | Description |
|---|---|---|---|
| 0x0 | char[4] | 4 | "FONT" magic fourCC |
| 0x4 | u32 | 4 | Version; see below |
| 0x8 | u32 | 4 | Unknown |
| 0xC | s32 | 4 | Line height |
| 0x10 | 4 | Paragraph upper margin | |
| 0x14 | 4 | Line margin | |
| 0x18 | 4 | Unknown | |
| 0x1C | 2 | Unknown | |
| 0x1E | 4 | Font Size (in points) | |
| 0x22 | N | Font name; zero-terminated string | |
| 0x22+N | 4 | TXTR file ID | |
| 0x26+N | 4 | Unknown | |
| 0x2A+N | 4 | Glyph Count | |
| 0x2E+N | Glyphs (Version 2, Version 4) |
Version
| Version | Game |
|---|---|
| 1 | Metroid Prime Kiosk Demo |
| 2 | Metroid Prime NTSC 0-00 |
| 4 | Metroid Prime PAL/Player's Choice and Metroid Prime 2 |
| 5 | Metroid Prime 3, DKCR |
Glyph Entry (Version 2)
| Offset | Type | Size | Description |
|---|---|---|---|
| 0x0 | u16 | 2 | UTF-16 character |
| 0x2 | float | 4 | Left UV coordinate |
| 0x6 | float | 4 | Top UV coordinate |
| 0xA | float | 4 | Right UV coordinate |
| 0xE | float | 4 | Bottom UV coordinate |
| 0x12 | u32 | 4 | Left padding |
| 0x16 | u32 | 4 | Print head advance |
| 0x1A | u32 | 4 | Right padding |
| 0x1E | u32 | 4 | Width |
| 0x22 | u32 | 4 | Height |
| 0x26 | u32 | 4 | Base offset |
| 0x2A | u32 | 4 | Kerning index |
| 0x2E | End of glyph definition | ||
Glyph Entry (Version 4)
| Offset | Type | Size | Description |
|---|---|---|---|
| 0x0 | u16 | 2 | UTF-16 character |
| 0x2 | float | 4 | Left UV coordinate |
| 0x6 | float | 4 | Top UV coordinate |
| 0xA | float | 4 | Right UV coordinate |
| 0xE | float | 4 | Bottom UV coordinate |
| 0x12 | u8 | 1 | Layer Index
|
| 0x13 | u32 | 4 | Glyph left padding |
| 0x17 | u32 | 4 | Print head advance |
| 0x1B | u32 | 4 | Glyph right padding |
| 0x1F | u32 | 4 | Glyph width |
| 0x23 | u32 | 4 | Glyph height |
| 0x27 | u32 | 4 | Kerning index |
| 0x2B | End of glyph definition | ||
Kerning Table
This table is at the end of the file, and defines kerning pairs. It starts with a 32-bit count value and then loops the following structure:
| Offset | Size | Description |
|---|---|---|
| 0x0 | 2 | Character 1 |
| 0x2 | 2 | Character 2 |
| 0x4 | 4 | Kerning adjust |
| 0x8 | End of entry | |