Jump to content

Final Fantasy XVI Demo .fnt (font) file format


SimplyKxG

Recommended Posts

I am looking into reverse engineering the font format for Final Fantasy XVI. It uses signed distance fields so I am unsure how the format works currently.

I decided to add the full structure that I can gather so far, if anyone wants to help contribute, feel free. Code given is from a 010 template so can be used to preview. Covers full format.

An example font image also attached.

Edit/Update, character bitmap placement found (had to be dividied by 4)

struct FontData;

const uint MAX_CHAR_COUNT = 65536;

struct Header
{
    char magic[4];
    ushort unk;
    ushort unk; //header size?
 
    uint stringPoolSize;
    uint fontDataSize; //after header (160 in bytes)
    ushort numCharacter; 
    ushort numCharacterInfo;
    uint numCharacterOffsets;
    
    float font_params[7]; //possible sdf params

    FSeek(64);
    string texFile; //file name for .tex image data
    string kerningFile; //file name for .ker kerning data
    
    FSeek(64 + stringPoolSize);
    FontData fontHeader;

}pzdHeader<bgcolor=cYellow>;

typedef struct 
{
    ushort char_table[MAX_CHAR_COUNT];
    
    struct CharacterInfo
    {
		ushort padd; //always 0
		ushort charOffsetIndex; //to offset section later
		uint charOffsetCount; //to offset section later
		
		float unk1; //always negative, -21.333334 when unk5/unk6 = 0
		float unk2; //always negative, -21.333334 when unk5/unk6 = 0
		float size; //possible size
		float zero; //always 0
		
		ushort bitmapX; //divide by 4 to get pos
		ushort bitmapY; //divide by 4 to get pos
		ushort bitmapSizeW; //divide by 4 to get size
		ushort bitmapSizeH; //divide by 4 to get size
    }chars[numCharacterInfo];
    
    struct CharacterOffsets //Not sure if this is offset data. 
    {
        ushort char1; //unsure
        ushort char2; //unsure
        float offsetX; //unsure
        float offsetY; //unsure
    }charOffsets[numCharacterOffsets];
    
}FontData;

image.png

image.png

Edited by SimplyKxG
  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...