How to select text font style in display st7735 tft spi

I'm having trouble selecting the font type for the text on the display st7735.
how do I do?
I tried: TFTscreen.setTextFont ();
but there was an error...
I'm using the TFT and SPI library
for example:
TFTscreen.begin ();
TFTscreen.setRotation (0);
TFTscreen.background (0, 0, 0);

can someone help me?

Read the documentation for Adafruit_GFX. e.g.

    TFTscreen.setTextFont(NULL);  //for built in 7x5 system font

#include <Fonts/FreeSans9pt7b.h>
    TFTscreen.setTextFont(&FreeSans9pt7b);  //FreeFont

Incidentally, I hope you are not using <TFT.h>

You should use the properly supported <Adafruit_ST7735.h>
Install it via the IDE Library Manager


I'm using
#include <TFT_eSPI.h>
#include <SPI.h>
#include <TFT.h>
this #include <Fonts / FreeSans9pt7b.h> is Adafruit.
creates conflicts with the TFT library

TFT.h is a complete abortion. Avoid it like the Plague.

TFT_eSPI.h is an excellent library intended for ESP8266, ESP32, STM32, Raspberry Pi Pico boards.
It should work just fine with Adafruit_GFX style programs and Fonts.

As always, run all the TFT_eSPI library examples before attempting to write your own sketch.


I thank you for your attention, but I have an extensive code, and to change the libraries now it would be a lot of work, so I am looking for a solution within TFT.
if you can't, i'll have to redo all the code

Seriously. TFT.h is a complete abortion with totally weird methods that were hooked onto an obsolete version of Adafruit_ST7735. You will have no end of problems if you use it with any proper application.

I strongly advise using Adafruit_GFX style classes. e.g. Bodmer's TFT_eSPI or a current Adafruit_ST7735

Yes, there might be a lot of work in converting TFT.h programs. But it is a wise move.

I doubt if TFT.h will even compile with ESP8266 or ESP32


I'm using UNO

My apologies. I assumed you had an ESP32 from #3.

#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Adafruit_ST7735.h>
#include <Fonts/FreeSans9pt7b.h>

Post your code or provide a link. We can advise if it is easy or difficult to port to regular GFX calls.

If it is a Uno the sketch can't be very big.