Stormcoast Fortress Spec sheets
[Font Files] - [.spk Files] - [Scenario(chk) Files] - [Iscriot.bin] - [Units.dat] - [Images.dat] - [Sprites.dat] - [Flingy.dat]



The .fnt files are relatively simple files. However you will need to load these from the CD or provide a copy of the file as the copies in stardat.mpq are encrypted.

First, a file header, 12 bytes.
typedef struct	_FontHeader {
	DWORD	Name;		//	Always is "FONT"
	BYTE	LowIndex;	//	Index of first letter in file
	BYTE	HighIndex;	//	Index of the last letter in file
	BYTE	MaxWidth;	//	Maximum width
	BYTE	MaxHeight;	//	Maximum height
	DWORD	Unk1;		//	Unknown / Unused
} FontHeader;

An alternative intepretation is as follows, however the first makes more sense:
typedef struct	_FontHeader {
	CHAR	Name[5];	//	Always is "FONT "
	BYTE	HighIndex;	//	Index of the last letter in file
	BYTE	MaxWidth;	//	Maximum width
	BYTE	MaxHeight;	//	Maximum height
	DWORD	Unk1;		//	Unknown / Unused
} FontHeader;

Next come offsets to each individual letter as DWORD values. (HighIndex - LowIndex offsets). Each of these is offset in the font file of a Letter header struct.

Letter header is as follows:
typedef struct  _FontLetterRaw {
	BYTE	Width;		//	Width of the letter
	BYTE	Height;		//	Height of the letter
	BYTE	XOffset;	//	X Offset for the topleft corner of the letter.
	BYTE	YOffset;	//	Y Offset for the topleft corner of the letter.
} FontLetterRaw;


The letter header is followed by a compressed BYTE array containing the data for the letter graphic itself. For each data BYTE, the top 5 bits set number of pixels to skip, while the lower 3 bits set the index in the color table to use for this letter. (game\tfontgam.pcx). So if you have a byte with the value 35(00100011), it is the third color (011b) and is preceded by 4 empty pixels (00100b).
The pcx file is only used as a reindexing table, the palette of the pcx file is ignored (as always in starcraft)

The decryption of the font files will not be covered here as it is a bit too complex, and the information could be easily abused.

Please credit Stormcoast Fortress if using these specs in a program.
All content copyright © 2001- 2005 Stormcoast Fortress