TFT RA8875 fonts

frohr

Well-known member
Hey all,
I tried many web pages but I am not sure hot set font fot my TFT RA8875.
Teensy 4.0

Code:
#include <SPI.h>
#include <RA8875.h>
#define RA8875_CS 10 
#define RA8875_RESET 9
RA8875 tft = RA8875(RA8875_CS,RA8875_RESET);

#include <Fonts/????>

...

tft.setCursor(100, 100);
tft.setFont(&?????);
tft.println("ARIAL FONT");

Is there any easy way? I am lost now ;-)
Thank you for any advice.


Michal
 
Hey all,
I tried many web pages but I am not sure hot set font fot my TFT RA8875.
Teensy 4.0

Code:
#include <SPI.h>
#include <RA8875.h>
#define RA8875_CS 10 
#define RA8875_RESET 9
RA8875 tft = RA8875(RA8875_CS,RA8875_RESET);

#include <Fonts/????>

...

tft.setCursor(100, 100);
tft.setFont(&?????);
tft.println("ARIAL FONT");

Is there any easy way? I am lost now ;-)
Thank you for any advice.


Michal

Basically you have to include the font you want to use by name such as:
Code:
// maybe a few GFX FOnts?
#include <Fonts/FreeMonoBoldOblique12pt7b.h>
#include <Fonts/FreeSerif12pt7b.h>
Notice that the file name name describes the font size as well.

Then when you want to use the that font:
Code:
tft.setFont(&FreeSansOblique12pt7b);

I am assuming you are using the RA8875 library bundled with Teensyduino. If you are there are a few examples of using fonts in the example folder as well.

EDIT: To use the ILI9341 type fonts you will need to down the ILI9341 font library as well: https://github.com/mjs513/ILI9341_fonts.
 
Basically you have to include the font you want to use by name such as:
Code:
// maybe a few GFX FOnts?
#include <Fonts/FreeMonoBoldOblique12pt7b.h>
#include <Fonts/FreeSerif12pt7b.h>
Notice that the file name name describes the font size as well.

Then when you want to use the that font:
Code:
tft.setFont(&FreeSansOblique12pt7b);

I am assuming you are using the RA8875 library bundled with Teensyduino. If you are there are a few examples of using fonts in the example folder as well.

EDIT: To use the ILI9341 type fonts you will need to down the ILI9341 font library as well: https://github.com/mjs513/ILI9341_fonts.

I am working against the exact same challenge (RA8875 fonts) & I did look at the examples noted. I do have a few additional questions:

1) what is the path to the font files ??
2) it seems that only certain sizes are available (as you mention re: the filename), true ??
3) does that imply that tft.setFontSize is not applicable/useable for these "custom" fonts ??

Thanks in advance for any additional insight/clarification that you can provide . . .

Mark J Culross
KD5RXT
 
I am working against the exact same challenge (RA8875 fonts) & I did look at the examples noted. I do have a few additional questions:

1) what is the path to the font files ??
2) it seems that only certain sizes are available (as you mention re: the filename), true ??
3) does that imply that tft.setFontSize is not applicable/useable for these "custom" fonts ??

Thanks in advance for any additional insight/clarification that you can provide . . .

Mark J Culross
KD5RXT

For the Font files you will need two libraries installed into your Arduino Libraries folder:
1. Adafruit GFX
and
2. the ILI9341 font library as well: https://github.com/mjs513/ILI9341_fonts.
once in your libraries folder just follow the examples posted.

it seems that only certain sizes are available (as you mention re: the filename), true ??
Yes only those font sizes can be used.

does that imply that tft.setFontSize is not applicable/useable for these "custom" fonts ??
Yes - its only applicable to internal fonts from what I remember. Think setTextSize still works with those fonts - its been awhile.
 
Hi, I installed https://github.com/mjs513/ILI9341_fonts
Now my example code looks like:

Code:
#include <SPI.h>
#include <RA8875.h>
#define RA8875_CS 10
#define RA8875_RESET 9
RA8875 tft = RA8875(RA8875_CS,RA8875_RESET);
#include <font_Arial.h>

void setup() {
  tft.begin(RA8875_800x480);
  tft.setRotation(2);
  tft.setTextColor(RA8875_WHITE, RA8875_BLACK);
  tft.setFont(Arial_8);
  tft.setCursor(50, 50);
  tft.println("TEXT test");

  tft.setFont(Arial_16);
  tft.setCursor(50, 100);
  tft.println("TEXT test");

  tft.setFont(Arial_32);
  tft.setCursor(50, 200);
  tft.println("TEXT test");

  tft.setFont(Arial_72);
  tft.setCursor(50, 300);
  tft.println("TEXT test");
}

void loop() {

}

Works well.

Thanks a lot!
 
Back
Top