Skip to main content

Using different Fonts

This repo describes how to use different free fonts(GNU FreeFonts) included in the library. You can follow this guide to choose your favourite font to display on the Wio Terminal!

Available Fonts

There are three main fonts that can be used in this library including Serif, Sans and Mono. Each font is available with few styles(bold, italic, oblique) and font sizes from 9pt, 12pt, 18pt and 24pt.

Using Fonts in Wio Terminal

To use these fonts easily, it is strongly recommended to copy the Free_Fonts.h file from the Seeed_Arduino_LCD repository. We assusme you have already dowmloaded the repository and the path is ~/Arduino/libraries/Seeed_LCD_master/examples/320 x 240/All_Free_Fonts_Demo, you can attach this header file to your sketch location. This would make referencing the fonts much easier.

To save a lot of typing, each font can be referenced in the sketch in three ways, either with:

1.Font file name with the & in front, such as: &FreeSansBoldOblique24pt7b.

Method 1 Example


2.FF# where # is a number determined by looking at the list in the Free_Fonts.h

Method 2 Example


3.An abbreviation of the file name. Look at the list below to see the abbreviations used.

Method 3 Example


Where the letters mean:

  • F = Free font
  • M = Mono
  • SS = Sans Serif (double S to distinguish is form serif fonts)
  • S = Serif
  • B = Bold
  • O = Oblique (letter O not zero)
  • I = Italic
  • No = point size, either 9, 12, 18 or 24

Example code using different fonts

#include"Free_Fonts.h" //include the header file
TFT_eSPI tft;

void setup() {
tft.fillScreen(TFT_BLACK); //Black background

tft.setFreeFont(&FreeSansBoldOblique12pt7b); //select Free, Sans, Bold, Oblique, 12pt.
tft.drawString("Sans Serif 12pt",70,80);//prints string at (70,80)

tft.setFreeFont(FF10); //select Free, Mono, Oblique, 12pt.
tft.drawString("Mono 12pt",70,110);//prints string at (70,110)

tft.setFreeFont(FS12); //select Free, Serif, 12pt.
tft.drawString("Serif 12pt",70,140);//prints string at (70,140)

void loop() {}

Tech Support & Product Discussion

Thank you for choosing our products! We are here to provide you with different support to ensure that your experience with our products is as smooth as possible. We offer several communication channels to cater to different preferences and needs.

Loading Comments...