Text Font Proportion: Difference between revisions
mNo edit summary |
mNo edit summary |
||
| (2 intermediate revisions by the same user not shown) | |||
| Line 13: | Line 13: | ||
|Rodin Pro Demi Bold | |Rodin Pro Demi Bold | ||
|18 ~ 20 px | |18 ~ 20 px | ||
| | |For system text and subtitles. | ||
|- | |- | ||
|<code>pf20_ff2.pfi</code> | |<code>pf20_ff2.pfi</code> | ||
|New Rodin Pro Ultra Bold | |New Rodin Pro Ultra Bold | ||
|~24.5 px | |~24.5 px | ||
| | |For main menu header text. | ||
|- | |- | ||
|<code>pf20_ff3.pfi</code> | |<code>pf20_ff3.pfi</code> | ||
|New Rodin Pro Ultra Bold | |New Rodin Pro Ultra Bold | ||
|~19.5 px | |~19.5 px | ||
| | |For main menu option text. | ||
|} | |} | ||
| Line 71: | Line 71: | ||
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 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:<syntaxhighlight lang="text"> | The length of the array can be calculated after reading the header by using the following expression: | ||
<syntaxhighlight lang="text"> | |||
CodePageLength - CodePageSeek - 1 | CodePageLength - CodePageSeek - 1 | ||
</syntaxhighlight> | </syntaxhighlight> | ||
To get the Unicode character a width pertains to, use the following expression:<syntaxhighlight lang="text"> | If a character has a width of zero, it'll fallback to the value stored in <code>CellWidth</code> 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: | |||
<syntaxhighlight lang="text"> | |||
CodePageSeek + CharacterIndex | CodePageSeek + CharacterIndex | ||
</syntaxhighlight> | </syntaxhighlight> | ||
[[Category:File Formats]] | [[Category:File Formats]] | ||
Latest revision as of 17:48, 5 May 2026
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 | For system text and subtitles. |
pf20_ff2.pfi
|
New Rodin Pro Ultra Bold | ~24.5 px | For main menu header text. |
pf20_ff3.pfi
|
New Rodin Pro Ultra Bold | ~19.5 px | 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