New fonts for Adafruit GFX library

Dear all
I have created a new font for the Adafruit GFX Library. Where do I have to store my new “xyz.h” Font file in platformio? In case it’s the same procedure as in Arduino IDE, where can I find the Adafruit GFX Library with its font folder in platformio?
Thanks for your help.

Per Using Fonts | Adafruit GFX Graphics Library | Adafruit Learning System this doesn’t necessarily need to be in the Fonts/ folder of the library. You can put in the include/ or src/ folder of the project as well.

The font header files contain only 3 objects: A byte array for font bitmap data, a byte array for font glyph data, and a GFXfont-type object that represents the font as whole (example).

So for the referenced example it would be the FreeMono9pt7b object that you can then use with tft.setFont(&FreeMono9pt7b);

Note that PlatformIO uses per-project library management by default. So, if your project uses the Adafruit GFX library, that project folder will have a copy of the library in .pio\libdeps\<environment name>\Adafruit GFX. As such if you put the font in the Font folder of that library folder, it will only be used for that project.

Global libraries can still be installed using the CLI and this command, but is not recommended per-sé due to the way global libraries may overshadow other correct libraries and fail compilation – per-project library declaration per lib_deps is preferred. Of course there might be use-cases like this where you’d actually want a global library installation to make a font available to every project that uses the library without adding it per-project. After a global library installation with pio lib -g install "Adafruit GFX Library", the library will be present in C:\Users\<user>\.platformio\lib.

Thank you very much for your help and explanation. I placed the file where you mentioned in my project folder.
Unfortunately it keeps telling me for my GFX-font type:

src/main.cpp: In function ‘void loop()’:
src/main.cpp:343:18: error: ‘My_Own_Sans_5’ was not declared in this scope
tft.setFont(&My_Own_Sans_5);

despite declaring:

#include <Adafruit_GFX.h>
#include <gfxfont.h>
#include <Adafruit_ST7735.h>
#include <Adafruit_I2CDevice.h>
#include <Fonts/My_Own_Sans_5.h> // I also tried with #include <My_Own_Sans_5.h>

Obviously I did not get it all correctly. Could you maybe help on this? Many thanks.

So what’s the exact content of that file?