Update 2015-09-05: Added a example font and Adobe Photoshop template.
Currently I am working on the deluxe version of the data logger. This version has a LCD screen and capacitive buttons to control the software. The Adafruit library for the display is quite large and almost uses the whole RAM, because it is a pixel oriented library. My own implementation is a text only library using 8×8 pixel characters. This simplify everything and reduces the RAM costs.
To convert the bitmap font into bytes, I wrote a small application for OS X (minimum version 10.10). It accepts a PNG image with the characters in it and converts it into bytes with the correct bits set.
First you select the mode on the left side of the application window. In this example the mode is set to “8×8 Fixed Top-Down”. Select the output format in the bottom left corner of the window.
Now drag your font file onto the area on the right side. If the dragged file is accepted, the window turns blue.
If there is any problem with your bitmap file for the selected mode, an error message with a description of the problem is displayed.
Click on the “Back” button to go back to the welcome screen and try again with your fixed bitmap file.
If the file is successfully converted, the resulting code is presented to you. At the bottom of the window are a number of buttons with further actions.
Click on “Save As…” to save the code into a source file. If you click the “Copy to Clipboard” button, a copy of the code is sent to the clipboard and you can paste it into a open file in your favourite code editor.
Here an example 8×8 pixel font file for the converter. The font converter ignores any transparent and light values. So you can use them on a second layer as a grid for the font.
You can use this font template for Adobe Photoshop if you plan to deign a own font. The template uses a grid on one layer, so you can draw the font information on the second layer.
You can download the application here. You need Mac OS X version 10.10 or newer to run this application.
Download Font to Bytes Version 1.0.2
After download, extract the ZIP (double click on it) and move the application into your “Applications” folder. To uninstall the application, just delete it.
License and Source Code
The software is licensed under the GNU general public license version 2. You can find the source code for the application here:
GitHub Repository of the Font to Bytes Application
The software is written in Swift 2 and is using many of the new features of this language. The code is extensible and you can easily add own converter and output formats. If you created useful additions, please let me know.
3 thoughts on “Convert Bitmap Fonts for LCD Displays with Style”
Hi, just wanted to let you know that I resurrected your project, updated it to Swift 4.1 and prepared a generic fixed-width font converter so that you can parametrize it (in code) and have a converter for any font width/height combination. My code is here: https://github.com/ayoy/FontToBytes and if you like I can prepare a pull request for you.
Many thanks for your great work, I was looking for this kind of tool to create more fonts for an e-paper display that I’m working on right now, and I was nicely surprised to find such a great quality tool 🙂 keep it up!
Hi Dominik! Thank you and great work!
I will have to check the actual changes you made. If you like I integrate your 12×7 converter in the main repository. Yet, to do this, you would have to actually document the resulting format for fonts with a bit mask which is wider than 8 bits.
Sure thing, I’ll update the docs and prepare a pull request, thanks!