The “Font to Byte” application converts bitmap fonts into a series of bytes which can be used by microcontroller to display text on LED or LCD displays.

Requirements

  • Requires Mac OS X 10.10 or newer.
  • Bitmap fonts in PNG format.

Usage

The Welcome Window

After starting the application you see the welcome window.

Font To Byte Welcome

The window has several controls which are explained below.

  • A – The mode selection. The mode controls how a bitmap is converted into byte and how the font is encoded into bytes.
  • B – Invert bits checkbox. If this box is checked, all bits are inverted. A white pixel will be a 0-bit, otherwise it will be a 1-bit.
  • C – Reverse bits checkbox. If this box is checked, the most left pixel in a character will be the lowest bit, otherwise it will be the highest bit.
  • D – The output format. This selection controls the format for the output. The format is just how the source code is written, bit it has no influence on the converted data.
  • E – The drop area. Drag and drop your PNG image into this area to start the conversion.

You find menu entries for all commands and keyboard shortcuts.

The Error Message

If there is any problem while converting the image into data, the error window is shown.

Font to Byte Error

Click on the “Back” button to return to the welcome screen.

The Result

The code result is shown after any successful conversion.

Font to Byte Result

  • A – The generated source code. You can select any portion of this code and copy it into your project.
  • B – The “Back” button. Click on this button to return to the welcome screen and start a new conversion.
  • C – Print a character map. If you click on this button, a character map will all converted characters is created as reference. You can also save a PDF from the print dialogue.
  • D – Copy to clipboard. Click on this button to copy the whole source code into the clipboard.
  • E – Save source code. If you click this button you can select a file to save the source code.

The Font Bitmap

The input bitmap file can be different for each mode. There are some common properties.

  • Only black pixel are used as set pixel.
  • You can use light greys for white pixel, this will allow you to add a raster or checkerboard pattern in the background as orientation.

This is an example of a font bitmap:

Font1

The Modes

8×8 Fixed Top-Down

The bitmap requires a width and height which is a multiple of 8. The 8×8 pixel blocks are read from left to right, from top to bottom. Each block is read as 8 bytes from top to bottom.

You can control the number of converted characters by choosing a matching size of the bitmap.

Bitmap Template for Adobe Photoshop

8×8 FIXED Left-Right

The bitmap requires a width and height which is a multiple of 8. The 8×8 pixel blocks are read from left to right, from top to bottom. Each block is read as 8 bytes from top to bottom.

You can control the number of converted characters by choosing a matching size of the bitmap.

Bitmap Template for Adobe Photoshop

Download

Download Version 1.1.0 of Font to Byte

After download extract the application from the ZIP file and copy the application into your “Application” folder. You can uninstall the application by moving it into the trash.

Source Code

The source code is licensed under the GNU public license version 2. The application requires Xcode 7 or newer with Swift 2 to compile the application.

Source Code of Font to Byte