I began working on a POV project recently and realized there were limited glyph (colloquially known as fonts) resources, especially for custom sizes.
I began looking for solutions. I found a very nice program for Windows written in .Net to convert system fonts to C data structures. I do not recall the name or URL, but since it converts Windows fonts, the licensing/copyrights of conversion is dubious anyway.
I also found BDF (Glyph Bitmap Distribution Format) glyph files in almost every size imaginable. These are also commonly distributed under open-source terms (GPL, MIT, etc). Perfect...
I have written a perl program to convert these BDF glyphs into C data structures. It will automatically detect the appropriate data size to store the resulting data and rotates the glyph 90 degrees clockwise. ie A 5x7 glyph requires one byte per data line (uint8_t), but a 10x20 requires 4 bytes per line (uint32_t). A nice preview of the glyphs are also generated.
An example of the 5x10 glyphs I generated:
Code: Select all
const uint16_t my_fontdata_5x10[256][5] = {
...
{ // char 64
0x007c, // *****
0x0092, // * * *
0x00aa, // * * * *
0x00aa, // * * * *
0x003c, // ****
},
{ // char 65
0x00f8, // *****
0x0024, // * *
0x0024, // * *
0x00f8, // *****
0x0000, //
},
{ // char 66
0x00fc, // ******
0x0094, // * * *
0x0094, // * * *
0x0068, // ** *
0x0000, //
},
...