The sample sketch called font_test prints out a portion of your font starting at a specified character at a specified magnification value.  Starting at line 8, there are a series of define statements that select which kind of display board you're using. The sample images in this tutorial show a 2.4 inch 320x240 TFT FeatherWing but you can use any of the boards listed in the sketch. You should un-comment only one of the definitions. This will automatically configure for that board using a code in board_select.h

//Uncomment only one of the following lines to select your display.
#define USE_ILI9341   //2.4 inch 320x240 TFT Feather Wing
//#define USE_HX8357    //3.5 inch 480x320 TFT Feather Wing
//#define USE_HALLOWING //Adafruit Hallowing M0 Express
//#define USE_PYGAMER   //Adafruit PyGamer 
#include "board_select.h"

In the file board_select.h are all of the configurations for the various boards supported. When using the TFT FeatherWings, it presumes you're using a Feather M0 or M4. If you're using a different Feather, you may need to change some of the parameters in that file. Look for the section that look like this.

//Assumes Feather M0 or M4 or other compatible
#define STMPE_CS 6
#define TFT_CS   9
#define TFT_DC   10
#define SD_CS    5

After configuring the sketch for your particular hardware, you should compile and upload the sketch. After compiling and uploading, open your serial monitor and you will see the following:

Type a positive number to adjust the first character displayed.
Type a negative number to change the magnifier. ie -2 multiplied by two.
Displaying 28 glyphs in 4 rows by 7 columns.
Displaying characters:0 through 27

On your display you will see the first 28 glyphs defined in the font as seen below. 

Type 28 into the serial monitor and press Enter and the display will now show glyphs 28-55. Note that the fifth one over is glyph 32 which is a blank space in the standard ASCII character set followed by 33 which is a "!" and so on. These are not symbols from our custom symbol font. These are being displayed from the FreeMono18pt7b.h font information.

You can continue to type in larger numbers to see the rest of the font but for our custom symbols you need to skip ahead to about 126 as shown below. Character 126 is ASCII "~" and then at 127 and beyond we continue with our other custom symbols. At the end, we put in several test squares just as placeholders for future expansion and the final arrow was just to let me know the software was displaying the proper number of glyphs.

You can also increase the magnification of the glyphs displayed. The program defaults to magnification 2 but let's try 4. You change the magnification by typing in a negative number. Let's go back to glyph zero by typing a "0" and pressing Enter. Then enter "-4" to see the following display.

Now type "-1" to see what a non-scaled version of the font looks like. This is the version that we will actually use in our program. It is displayed without gridlines.

Now that you know how to operate the display program, in the next section of the tutorial we will show you how to define some new character glyphs. This will illustrate how we created the file in the first place.

This guide was first published on Jul 16, 2019. It was last updated on Mar 08, 2024.

This page (Using the font display sketch) was last updated on Mar 08, 2024.

Text editor powered by tinymce.