Font and Bitmap Generator (LCD Font and bitmap to C code)


A great (free) font to C code converter can be found at:

Free registration is needed to activate the full version.

This program has following interesting features:

  • Conversion of Windows fonts.
  • Conversion of small bitmaps.
  • User configurable output through xsl.
  • Proportional and monospaced fonts.
  • ....

(see above link for a description of all features).

modified xsl output files usable with mbed

I included example fonts generated with this program.
In the program, tab 'Group attributes' - 'Byte orientation' was set to 'Horizontal Left'.
When using these fonts, make sure you read/write the bits in each byte left to right.
Otherwise the font will be mirrored (perhaps also a neat feature).

Have Fun...

Adding 16-bit output

Edit (march 2014)

The ZIP file containing the modified XSL output files has been updated with an additional file to create 16-bit output (based on the trial code mentioned below).

The code below is a trial to concatenate 2 consecutive bytes.
Test this code by opening any Tryit Editor window at w3schools (eg : OR (runs fine in Chrome, not in IE10).
First, erase the content of the XML and XSLT code windows.
Next, copy the content of the 2 listings below into their corresponding window.
Finally, click on the Edit and Click Me button to see the result.

Listing 1
Replace the contents of the XML Code window with this listing.

<?xml version="1.0" encoding="utf-8"?>
		<designer>Imported System Font</designer>
		<date>06 Mar 2014</date>
		<description>Imported System Font</description>

Listing 2
Note : The double if at the end checks for an uneven number of bytes to pad the last byte with '00'.
You can test this by adding a single <byte>0x20</byte> at the end of the </bitmap> list.
Replace the contents of the XSLT Code window with this listing.

<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Edited by XMLSpy® -->
<xsl:stylesheet version="1.0"
<xsl:template match="/">
      <xsl:for-each select="project/group/bitmap/byte">
          <xsl:when test="position() mod 2 = 1">
            <xsl:value-of select="." />
            <xsl:value-of select="substring(., 3, 2)"/>
            <xsl:if test="position()!=last()">
              <xsl:text> ,</xsl:text>
        <xsl:if test="position()=last()">
          <xsl:if test="position() mod 2 = 1">

This is the output.

0x0001 ,0x0203 ,0x0405 ,0x0607 ,0x0809 ,0x0A0B ,0x0C0D ,0x0E0F ,0x1011 ,0x1213 ,0x1415 ,0x1617 ,0x1819 ,0x1A1B ,0x1C1D ,0x1E1F 

10 comments on Font and Bitmap Generator (LCD Font and bitmap to C code):

09 Mar 2014

Need help with XSLT V1.0 conversion.

Very nice, flexible font & bitmap generator!

I have used Frank Vannieuwkerke's transformation file however I would like to create output files that result in uint16_t 16-bit data font files rather than the 8-bit unsigned integer char files it currently provides. I have no previous experience with XSLT transformations however upon studying the architecture, I have learned enough to get me into trouble and stuck only partially meeting my objective. A 16-bit font file structure would reduce overhead processing for my application leaving resources to focus more on other processing requirements instead of assembling 8-bit data into 16-bit font conversions.The schema of the temporary XML file output of the program which the XSL transformation stylesheet would be based upon is here: /media/uploads/dtmort/testxmlout

I can manipulate some of the XSL stylesheet however I am out of my element attempting concatenation of the hexadecimal 'byte' elements into half as many 16-bit 'words' as well as the recursive index generation to match.

Having zero experience with this leaves me at a deficit. Any help is appreciated.

09 Mar 2014

It took me some time to modify the XSLT code to fit my needs as i am not an XSL expert either.
Back then, I used as a reference to learn more about XSLT.
As the XML output is 8-bit oriented, either we need to ask the developer to add 16-bit XML output or have the XSLT code use concat and position to join 2 consecutive <byte> ... </byte> lines.
This is currently beyond the scope of my XSLT knowledge. Perhaps other, more experienced XSLT users, can come up with a solution.
If I can free up some time, I will have a closer look at it.
Can you share the XSLT code you already created?

09 Mar 2014

Frank, I too used to learn about XSLT and approached trying to utilize the similar functions replace(), concat() and position() to join 2 consecutive <byte> ... </byte> lines. Under V1.0 these are 'unknown XSLT functions' and apparently only available to V2.0 code.

My XSLT code is hardly complete or functional when I began to struggle with syntax and spent way more time than expected without the results desired. /media/uploads/dtmort/mugui2c_mbed_16-bit_output.xsl

I will email the developer and see if he can help.

Regards, David

10 Mar 2014

I searched a little further using the w3school Tryit Editor - we can concatenate the output without using concat or any other 'special' function. If you want to check whether the code I created fits your needs, open any Tryit Editor window at w3schools (eg : and erase the content of the XML and XSLT code windows.
Next, copy the content of the 2 listings I added to this Notebook page (Adding 16-bit output) into their corresponding windows.
Finally, click on the Edit and Click Me button to see the result.

If this is what you want, we only need to create a code template and squeeze calls to it into the XSL file.
This code can probably be optimized further as it was a quick test.

12 Mar 2014

That perfectly accomplishes the concatenation using substring(). Thanks for pointing out the Tryit Editor as had overlooked it on my visits to the w3schools site. I had heard back from the developer who had not worked with XSLT since 2009 and found it not to be a pleasant experience! It is a verbose programming language.

Your help is very much appreciated to date and I may undertake another pass at it using the Tryit Editor in the coming weeks.

Regards, David.

12 Mar 2014

Yes, XSLT is a real pain Meanwhile, I am also reworking the code for 16-bit output as several calculations need to be modified.
It is almost finished, I only need to solve a formatting problem.
I also found a much better online tool to test XML/XSLT code : (runs fine in Chrome, not in IE10).

12 Mar 2014

16-bit output XSL file is available - link at top of this page.

16 Mar 2014

Thanks Frank.

I found the the index generation for proportional fonts was still calculating based on bytes rather than words. I made some adjustments to the formulas, updated the 'C' array declarations to 16-bit, and other minor adjustments to suit using 'vertical bottom' orientation my project requires. I know there are some bugs to work out for the other 'orientation' settings.

Here is the transformation sheet I ended up with: /media/uploads/dtmort/dtmort_mbed_16_bit.xsl

I know I have some alignment issues in the formulas that place the proportional font information after the font data, but I can manually clean those up within the compiler.

Regards, Dave

23 Mar 2014

16-bit output : All issues are fixed - download link at top of the page is updated.

02 Sep 2014

The FBG software creates garbage output if you create 42x64 font with vertical ceiling setting. Much visually better results than drawing large font by hand (if you need small number of characters like numbers only) you get easily by creating each character with gimp, export characters to .bmp files and use free LCD Assistant windows software.

Please log in to post comments.