In this tutorial we will show you how to create custom symbol fonts for the Adafruit GFX library.
The Adafruit GFX library has a number of custom fonts ranging in size from 9-24 points. There is a mono space font similar to Courier, a Sans Serif similar to Arial or Helvetica, and a Serif font similar to Times. There are also bold, oblique, and bold oblique versions of each of these. But these fonts only cover the standard ASCII character set from 32-126 printable characters. There are no special symbols such as arrows, card suits, or other dingbats that you would find in your usual symbol type fonts.
There is the ability to create a font in the proper format using a font conversion tool provided with the library. But it is a commandline utility that needs to be recompiled for your particular variety of Linux. For a Mac or PC user, compiling a utility and running it from a commandline is a hurdle many people (including myself) don't care to tackle. Even though I have several Raspberry Pi units sitting around that is still beyond my particular skill set.
Even if I could compile and run the utility, I would have to search for a type font to be converted that contained the symbols I wanted. It might even require converting multiple fonts just to gather up everything I wanted.
I needed to create a custom symbol font that would display media controls such as rewind, fast-forward, play, pause, stop as well as arrow keys in eight directions and some other custom designs such as a Bluetooth or a power button. So I developed a technique described here to layout the bitmaps for these custom symbols and manually put together a custom symbol font.
I created these special symbols for an assistive technology device that I call my "Ultimate Remote". It allows me to operate TV, cable, Blu-ray and other devices via infrared remote signals as well as make a Bluetooth connection to my iPhone for switch control. I can operate these devices with just three pushbuttons. I will be documenting that device very soon, but we wanted to show how I created these custom symbols. Here is a screen grab of the cable TV controls page on my remote. It shows items like fast-forward and rewind and other typical media controls symbols.
Here are some more screen grabs showing a mouse control page and another page which implements an entire board including function keys along the bottom of the screen.
I will describe the system I used and provide you with the sample sketch so that you could use my custom symbols or adapt symbols of your own.
This learning guide presumes that you are somewhat familiar with the Adafruit GFX library and how to use custom fonts with that library. You can find more information on the library and the text capabilities at the learning guide found here. It also presumes some understanding of hexadecimal notation and how to turn a string of bits into a hex value.
Text editor powered by tinymce.