Jump to content

Text Font Map: Difference between revisions

From HedgeDocs
Hyper (talk | contribs)
mNo edit summary
Hyper (talk | contribs)
mNo edit summary
Line 150: Line 150:
|const char*
|const char*
|pTextFontPicturePath
|pTextFontPicturePath
|A pointer to the path to the '''Text Font Picture''' for this font.
|A pointer to the path to the [[Text Font Picture]] for this font.
If non-applicable, this should be null.
If non-applicable, this should be null.
|-
|-

Revision as of 20:46, 4 December 2025

Text Font Map is a file format used in Sonic the Hedgehog (2006) for storing font character information.

These files are located in text.arc under the ./text/ directory from platform root as *.ftm files.

Specification

Text Font Map uses a Binary Resource container.

Header

The header consists of the following data structure:

Length: 0x14
Offset Type Name Description
0x00 Char[4] Signature Always "FNTM".
0x04 UInt32 CodePageCount The number of code pages mapped in this font.

This is a zero-based count, so 0 = 1.

0x08 UInt32 CodePageTableOffset The offset of the table of code page offsets.
0x0C Byte Columns The number of columns in the font atlas.

This field is not used by the game. See Static Font Data.

0x0D Byte Rows The number of rows in the font atlas.

This field is not used by the game. See Static Font Data.

0x0E UInt16 N/A Unknown. Always 1.
0x10 UInt32 FontNameOffset The offset of the name of this font.

Code Page Table

The code page table is an indirection table with a fixed size of 256 elements.

Each element is a 32-bit offset that points to a fixed 256 element page of characters in Unicode. These characters consist of cell information and flags that map to the font atlas texture.

Character

Each character is stored as the following data structure:

Length: 0x04
Offset Type Name Description
0x00 Byte Column The column of this character cell in the font atlas texture.
0x01 Byte Row The row of this character cell in the font atlas texture.
0x02 UInt16 Flags The flags for this character.

If 0xFFFF, this character will be unset.

To get the Unicode character this element pertains to, use the following expression:

Character = (CodePageIndex << 8) | CharacterIndex

Static Font Data

The game stores the last remaining font information in a static array in the executable.

The array can be found at the following addresses:

Platform File Virtual Address Physical Address
Xbox 360 default.xex 0x82B7F860 0xB82860
PlayStation 3 EBOOT.BIN 0x100DDA20 0x178DA20

The array consists of three elements of the following data structure:

Length: 0x1C
Offset Type Name Description
0x00 uint32_t ID The ID of this font.
0x04 const char* pTexturePath A pointer to the path to the font atlas texture.
0x08 uint16_t TextureWidth The width of the font atlas texture.
0x0A uint16_t TextureHeight The height of the font atlas texture.
0x0C const char* pTextFontMapPath A pointer to the path to the Text Font Map for this font.
0x10 const char* pTextFontProportionPath A pointer to the path to the Text Font Proportion for this font.
0x14 const char* pTextFontPicturePath A pointer to the path to the Text Font Picture for this font.

If non-applicable, this should be null.

0x18 uint16_t CellWidth The width of each character cell in the font atlas texture.
0x1A uint16_t CellHeight The height of each character cell in the font atlas texture.
Cookies help us deliver our services. By using our services, you agree to our use of cookies.