vindar / tgx

tgx - a tiny/teensy 3D graphics library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ILI9341 fonts from Paul not working for me

DIYLAB-DE opened this issue · comments

commented

Dear Arvind,

I would like to use the fonts from this repo: https://github.com/PaulStoffregen/ILI9341_fonts and just can't manage it with TGX.
Do you have a working example for me?

Kind regards
Bruno

Hi Bruno,

I just made some change to the library to make it easier to mix c and c++ files. Now, all you need to do to use the fonts from Paul's library is to replace the #include "ILI9341_t3.h" by #include "tgx.h" in the font header files...

Alternatively, if you do not want to modify the .h files of the fonts, you can just create a file called ili9341_t3.h on the directory where the fonts are located containing the line #include <tgx.h>. Here is an example on how it can be done: fontExample.zip

Just a couple of remarks:

  1. The fonts in Paul's library were created 6 years ago. This was prior Teensy 4 and therefore the large arrays do not contain the PROGMEM directive which means they are placed in RAM instead of FLASH memory on Teensy 4/4.1. I strongly suggest that you edit the .c files to add PROGMEM to all the large arrays (of the fonts you are using). This will not affect draw speed but may end up saving a lot of RAM, especially if you are using many large fonts...
  2. You can use my tgx-font library which contains classic fonts but also anti-aliased fonts which should give a better quality. I just converted a bunch of random fonts downloaded from google font but I also explain in this python script how to generate anti-aliased fonts from any .ttf font so you can create your own if you want.
commented

Hi Arvind,

thank you very much for the detailed explanation.
Then it really makes sense if I convert the fonts myself.
I will read the description thoroughly, because I haven't worked with Python yet ;o)
I am interested in fonts that simulate LCD and 7(16) segment displays.

Kind regards
Bruno