This tool (aka "dirty hack") can be used to convert TTF or BDF fonts to the GRX format used by DOjS, Allegro, MGRX and GRX.
It uses libschrift for loading and rendering TTFs and MGRX code to write out GRX, FNA and GRX-as-C-source output. The BDF parser was cobbled together by me w/o documentation just using some examples and the english Wikipedia page.
When converting fonts make sure the resuting filename ends with ".FNT", other extensions do not work with Allegro.
I might provide pre-compiled DOS, Linux and Win32 binaries later...
Usage:
fntconv [-cf] <TTF or BDF file> <size> <outfile>
Please note: the -f
flag is only for testing purposes and -c
generates C code to be compiled into you program. Both flags should not be used when converting fonts to be loaded from disk with Allegro or GRX. Also: both flags are quite untested!
My code and everything MGRX is licensed under GPLv2 (see LICENSE). Libschrift is licensed under ISC (see libschrift/LICENSE).
Because I have absolutely no clue about font rendering I took several shortcuts when calculation offsets, sizes and other stuff. So expect weird results and warning messages when using this!