9 years, 4 months ago.

I get an error Error: Identifier "Font8x12" is undefined in "main.cpp", Line: 20, Col: 21

I get an error Error: Identifier "Font8x12" is undefined in "main.cpp", Line: 20, Col: 21 if I use the below code.

TFTLCD

#include "mbed.h"

// include the library, this will also pull in the header for the provided fonts
#include "ssd1289.h"
 
 // prepare the data bus for writing commands and pixel data
 BusOut dataBus( p30, p29, p28, p27, p26, p25, p24, p23, p22, p21, p20, p19, p18, p17, p16, p15 ); // 16 pins
 // create the lcd instance
  SSD1289_LCD lcd( p14, p13, p12, p11, &dataBus ); // control pins and data bus
 
  int main()
  {
      // initialize display - place it in standard portrait mode and set background to black and
      //                      foreground to white color.
      lcd.Initialize();
      // set current font to the smallest 8x12 pixels font.
      lcd.SetFont( Font8x12 );
      // print something on the screen
      lcd.Print( "Hello, World!", CENTER, 25 ); // align text to center horizontally and use starndard colors
 
      while ( 1 ) { }
  }

If I use lcd.SetFont( &TerminusFont ); it compiles, is that correct?

Question relating to:

This is a port of Henning Kralsen's UTFT library for Arduino/chipKIT to mbed, refactored to make full use of C++ inheritance and access control, in order to reduce work when … HX8340, ILI9325, ILI9328, ITDB02, LCD, SSD1289, ST7735, TFT, UTFT

1 Answer

9 years, 4 months ago.

Looking at the library history, it looks like there used to be a file called fonts.h which defined Font8x12. However, in January 2013, he replaced the old fonts with the new Terminus fonts. So presumably, you will need to do an #include of the terminus.h file, and then refer to one of the Terminus fonts that are included, they are called TerminusFont and TerminusBigFont.