// Tribes 1 .pft Font Format by Andrew // All incorrect conclusions/errors/retarded constructs (C) Dynamix // // Generic block header. 4 character tag, followed by the size of the block // typedef struct { char tag[4]; unsigned long size; } tBlock; // // PBMP pieces // typedef struct { tBlock pbmp; tBlock head; unsigned int ved1; unsigned int width; unsigned int height; unsigned int ved2; unsigned int ved3; tBlock data; } tPBMP_header; // // PBMP Footer. Who knows what the hell DETL is for. PiDX stores the Internal // palette ID for Tribes. Where this ID comes from or where the HELL Labrat // found the pal name/id correlations I have no idea. I just ripped his // Name/ID pairs from his Tribestools program // Note: Some fonts don't have a PiDX? I assume pal ID (0xffff/-1: Base.pal) for // those. typedef struct { tBlock detl; unsigned long detl_1; tBlock pidx; signed long paletteidx; } tPBMP_footer; // // Full PBMP // typedef struct { tPBMP_header header; unsigned char * data; // follows 'data' block tPBMP_footer footer; // not fully in all fonts? some are missing pidx } tPBMP; // // PBMA pieces. Numbitmaps repeated (retarded) // typedef struct { tBlock pbma; tBlock head; unsigned int numbitmaps; unsigned int numbitmaps_; } tPBMA_header; // // Full PBMA. Hardcoded for a single PBMP because I'm lazy. It should actually be // "tPBMP pbmp[numbitmaps]" // A few fonts (including if_mr_36b.pft, the only multiple PBMP font) // don't have the pidx section at the end of the PBMP, which would introduce // some complications in reading the files typedef struct { tPBMA_header head; tPBMP pbmp; //just use one bitmap in the pbma gay } tPBMA; // // PFON pieces // // // Nothing special, just done for completness sake. // typedef struct { unsigned short charat; } tPFON_char; // // The mysterious character format. In depth: // pbaindex: The PBA this character is located on. Default: 0 // xoffest : The X Coordinate in the bitmap this character starts at // yoffset : The Y Coordinate in the bitmap this character starts at // width : Width of the character in pixels // height : Height of the character in pixels // voffset : Manually move the bitmap [voffest] pixels from the default horizontal // rendering position. Negative value adjusts the character up, Positive // adjusts it down. // typedef struct { unsigned char pbaindex; unsigned char xoffset; unsigned char yoffset; unsigned char width; unsigned char height; signed char voffset; unsigned char pfon_charattr_1; unsigned char pfon_charattr_2; } tPFON_charattr; // // PFON guts. Constants are commented and are unknown // // characters: Number of characters in the file (Assumed constant, 224) // fontheight: Number of pixels to move down for a newline. The font characters // will be rendered with their actual height regardless of this value, // but they will be overwritten if this does not adjust the font down // far enough to compensate the largest characters height // fontwidth : This isn't a fixed width font format, what the hell. Useless // color : Seems to be useless, no idea why it's in here // voffset : How far to manually move each character down when displaying it. // This allows you to render a string at (0, 0) and not have the // entire thing get clipped. Usually the value of the average character // height + 1 // numchars : Number of characters (again). Presumed to be constant (224) // startchar : ASCII value of the first character in the file, assumed to be constant (32, Space) // charlist : This is pretty retarded, [numchars] entries, starting at 0 and going up to numchars // charattrs : The attributes for all the characters in the font typedef struct { tBlock pfon; unsigned long pfon_1; // 0x2 unsigned long pfon_2; // 0x0 unsigned long pfon_3; // 0x45 unsigned long characters; unsigned long fontheight; unsigned long fontwidth; unsigned long color; unsigned long pfon_4; // 0x0 signed long voffset; unsigned long pfon_5; // 0x10000 unsigned long pfon_6; // 0x10000 unsigned long pfon_7; // 0x1 unsigned short numchars; unsigned short startchar; tPFON_char charlist[224]; //constant? :| tPFON_charattr charattrs[224]; //constant? :| } tPFON_Header; // // Full PBMP. Just the PFON Header with a PBMA plastered below it // typedef struct { tPFON_Header header; tPBMA pbma; } tPFON;