Monday, April 8, 2019

Mega Sg Utilities - Font Generator Tool (plus Font Pak!)

Now that the Analogue Mega Sg is shipping, retro gaming enthusiasts are finally able to get an all in one solution for playing Sega Genesis games (and legacy ones too) on modern displays via HDMI. One of the interesting new features introduced with the Mega Sg is the ability to import custom fonts to tailor the OSD look to ones liking. Analogue provides a description of the file format and usage in their Mega Sg Reference Guide:
The user loaded font allows you to select your own font in place of those which come with the Mega Sg. The load font option will bring you to the file browser. If you have a directory called FONT at the root of your SD card, it will default to that directory to load a font file. The font must use an 8x8 text box and must be represented in binary in a 1-bit per pixel format. Each character will take eight bytes to represent in this format. The file must be 768 bytes in size and use the extension .fnt. The characters in the file will have to start at ASCII 20 (space) and end at ASCII 7F (delete).
Binary representation of an 'A' character font 
I've created a PowerShell module (MegaSgUtils) containing a cmdlet named New-MegaSgFont that generates fnt files from prepared source image files (aka Font sheets).