How to display ‘à' 'é’ on display TFT 2.4’'

Hello everyone, I would like to know how I could use the French characters (é, à, on a tft screen

here is a beginning of code below that I started however it does not display me the "é" and the "à



// Pause in milliseconds between screens, change to 0 to time font rendering
#define WAIT 1000

#include <TFT_eSPI.h> // Graphics and font library for ILI9341 driver chip
#include <SPI.h>

TFT_eSPI tft = TFT_eSPI();  // Invoke library, pins defined in User_Setup.h

unsigned long targetTime = 0; // Used for testing draw times

void setup(void) {
  tft.init();
  tft.setRotation(1);
}

void loop() {
  targetTime = millis();

  // First we test them with a background colour set
  tft.setTextSize(1);
  tft.fillScreen(TFT_BLACK);
  tft.setTextColor(TFT_GREEN, TFT_BLACK);

  tft.drawString("TEST é à", 0, 48, 2);

  delay(WAIT);


}

Has anyone ever had this problem

My guess is that the default font does not include extended ASCII. I think it will work if you have a font that includes the desired characters. Check the TFT_eSPI library sources to see if they supply an extended font.

The String is encoded in UTF8 when compiled so characters could be multi-bytes long but for those characters UTF8 matches the extended ASCII code so it could indeed work with a suitable font. From the GitHub

7. Frank Boesing has created an extension library for TFT_eSPI that allows a large range of ready-built fonts to be used. Frank's library (adapted to permit rendering in sprites as well as TFT) can be downloaded here. More than 3300 additional Fonts are available here. The TFT_eSPI_ext library contains examples that demonstrate the use of the fonts.

EDIT: actually Unicode is supported so 2-bytes code would work

Fonts

The library contains proportional fonts, different sizes can be enabled/disabled at compile time to optimise the use of FLASH memory. Anti-aliased (smooth) font files in vlw format stored in SPIFFS are supported. Any 16 bit Unicode character can be included and rendered, this means many language specific characters can be rendered to the screen.

The library is based on the Adafruit GFX and Adafruit driver libraries and the aim is to retain compatibility. Significant additions have been made to the library to boost the speed for the different processors (it is typically 3 to 10 times faster) and to add new features. The new graphics functions include different size proportional fonts and formatting features. There are lots of example sketches to demonstrate the different features and included functions.

Configuration of the library font selections, pins used to interface with the TFT and other features is made by editing the User_Setup.h file in the library folder, or by selecting your own configuration in the "User_Setup_Selet,h" file. Fonts and features can easily be enabled/disabled by commenting out lines.

Hello I have installed a library "TFT_eSPI_ext" and I used the example "Font_test" however I have the following error

don't post an image of text.. you have a button made especially for copying the error message, use it

image

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.