FONT LFD Resource Type Author: Jagged Fel (jaggedfel621@gmail.com) Site: http://idmr.empirereborn.net Updated: 2009.10.05 ===== The FONT Resource type contains the fonts seen in various locations of the game. "font6" is used as map and FG tags within the briefing, "font8" is the title text and caption text. "font12" and "font18" are seen in the pilot selection screen. These 4 are all found in EMPIRE.LFD, and are just examples, they are used in multiple places and are not the only ones. The information itself is a monochrome bitmap image, one for each glyph. ===== FONT Structure The following values are used through this and all of my file definitions unless otherwise specified: NAME LENGTH DESC ---- ------ ---- BYTE 1 unsigned 8-bit CHAR 1 ASCII character SHORT 2 signed Int16 INT 4 signed Int32 -- 0x00 Header 0x10 SHORT StartingChar (0x20) 0x12 SHORT NumberOfGlyphs 0x14 SHORT BitsPerScanline 0x16 SHORT Height 0x18 SHORT BaseLine 0x1A SHORT Reserved (0) 0x1C BYTE[NumberOfGlyphs] GlyphWidths Glyph[] -- struct Header (size 0x10) { 0x0 CHAR[4] "FONT" 0x4 CHAR[8] Name 0xC INT Length } struct Glyph (size BitsPerScanline*Height/8) { BYTE[Height,BitsPerScanline/8] Rows } ===== FONT Detail In TIE95 there are a total of seven FONT resources, all of which have a StartingChar of 0x20, which makes sense since you kinda need a space, and there's nothing really before that anyway. Only "TITLE.LFD/helv-20" has a non-0x60 value for NumberOfGlyphs, which is the scrolling text in the title crawl. BitsPerScanline tells you how much you have to read before going on to the next line. Always a multiple of 8. Height is just that, how many rows per glyph. BaseLine is a zero-indexed row that is defined as the bottom of the glyphs. This is so letters such as 'j' and 'g' hang below the line as they should. The GlyphWidth values are in pixels, starting from the left of the glyph. -- Row -- The Row values within the actual glyph data are bit fields. Monochrome bitmaps, so '0' is transparent, '1' is solid. E0 A0 E0 A0 A0 00 from "EMPIRE.LFD/font6" is the letter 'A' XXX..... E0 = b11100000 X.X..... A0 = b10100000 XXX..... b11100000 X.X..... b10100000 X.X..... b10100000 ........ b00000000 If the BitsPer value is 0x10, then the rows are 16 pixels wide, 0x18 is 24 pix wide, etc. The Width value for the letter 'A' in this case is 03, which as can be seen makes sense. Spaces between letters are automatically counted as 1 pixel. =====