Text Font Proportion
Text Font Proportion is a file format used in Sonic the Hedgehog (2006) for storing font character proportions.
These files are located in text.arc under ./common/text/ as *.pfi files.
| Name | Font | Size | Description |
|---|---|---|---|
| pf20_ff.pfi | Rodin Pro Demi Bold | 18 ~ 20 px | Used for system text and subtitles. |
| pf20_ff2.pfi | New Rodin Pro Ultra Bold | ~24.5 px | Used for main menu header text. |
| pf20_ff3.pfi | New Rodin Pro Ultra Bold | ~19.5 px | Used for main menu option text. |
Specification
Header
The header consists of the following data structure:
| Offset | Type | Name | Description |
|---|---|---|---|
| 0x00 | Char[4] | Signature | Always "PRFI". |
| 0x04 | UInt32 | DataOffset | The offset of the Proportion Table. |
| 0x08 | UInt16 | Kerning | The amount of spacing between each character in a string. |
| 0x0A | UInt16 | CellWidth | The width of each character cell in the font atlas. |
| 0x0C | UInt16 | CodePageSeek | The amount of characters to skip from the beginning of the code page. |
| 0x0E | UInt16 | CodePageLength | The total size of the code page (including the skipped characters from CodePageSeek). |
Proportion Table
The proportion table is an array of bytes that correspond to pixel widths of Unicode characters. The first 0x20 bytes in the code page are usually skipped, as they're control characters and typically aren't intended to be displayed.
The length of the array can be calculated after reading the header by using the following expression:
CodePageLength - CodePageSeek - 1
If a character has a width of zero, it'll fallback to the value stored in CellWidth in the header. This is usually the case for Japanese characters, as they always have the same fixed width. To get the Unicode character a width pertains to, use the following expression:
CodePageSeek + CharacterIndex