FON File Format

FON File Format
Byte LengthDescription
4Max ASCII value supported
4Max width of character in pixels
4Max height of character in pixels
4Graphic segment byte size
20 * (Max supported value)Character details block. Contains [X offset, Y offset, Width, Height, Offset in Graphics segment] for each character
2 * (Graphic segment byte size)Graphic segment (16bit)



Fon data structure
struct fon_container_t      // FON container
{
     INT32 max_value_supported;     // Max ASCII value supported [Read from file]
     INT32 max_width;               // Max width of character in pixels [Read from file]
     INT32 max_height;              // Max height of character in pixels [Read from file]
     INT32 details[1280];           // Character details block [Read from file] [Buffer Overflow] 
     INT32 graphic_segment_size;    // Byte size of graphic segment [Read from file] 
     INT16 *graphic_segment;        // Graphic segment 16bit [Read from file] 

     INT32 screen_width;            // Screen buffer width in pixels       
     INT32 screen_height;           // Screen buffer height in pixels 
     INT32 letter_spacing;          // Number of pixels between letters  
     
     INT16 font_colour;             // Font colour 16bit
     INT32 intersperse;             // Ouput every other pixel: 0 = No, 1 = Yes
};


Ouput of fonts used by Blade Runner onto a 640x480.