Let’s Make: Traffic Department 2192 – Part 10

Assets - Converting Fonts to Bitmaps

Traffic department includes three font files: TD-LET.CIN, TD.LTR, and TD.LT2. However, TD.LTR doesn't see much use, if any, in the actual game. Scanning the binaries for references to that file comes up empty. We're going to treat these files just like any other graphics asset - convert the glyphs in to a bitmap sprite strip that we can bring in to our engine. When we do import the sprites as a font, we'll have to build a link between text characters and the matching sprite frame.

Font File Format

The Font files are a simply a character stream of all glyphs in sequence where the binary loader has a priori knowledge of the dimensions. There is know associated color information, but I will use the default palette simply so we can reuse code. Font color is meaningless since we'll eventually mask all glyphs to produce desired text color. We want all glyphs to be white.

File Dimensions Notes
TD-LET.CIN 8x8 Used for the banners during the briefing including mission titles
TD.LTR 12x16 Not used...?
TD.LT2 5x5 Small font used everywhere throughout the game

Conversion Process

Read in TD.PAL so we can exploit past code. Scan through our input file given known dimensions. Write the resulting set colors to the output container. Again, we're targeting a sprite strip so ensure that pixels are properly positioned. We'll force all non-black pixels to white later during import and post-processing in the engine.

C Source Code

Getting tired of the same C program?