I've seen 2 other topics asking related issues about fonts and font sizes on LVGL with no responses. Surely there other users with this issue and need answers? I come from C# and Python background and pretty new to Arduino, I hardly ever submit questions to forums unless I have tried everything I can think of, and after reading up about what has happened with Arduino lately releasing products with little to no documentation, and examples that don't work out of the box, I am turning to the community for any signs of life about this issue.
So I have the Giga R1 with the Giga display shield, using LVGL libraries. First hurdle was the library version where v9.0.0 is riddled with errors, and have to roll back to 8.3.11 to get the basic demo to work. Great it works, kind of weird but just ignore that library update from now on..
Now I have created a nifty little GUI with lovely colours and shapes, some widgets, all the positioning is great, event handlers all work, can navigate nicely no issues here. The GUI is on the M7 core, while the controller sketch is running on the M4 core, gathers data on all the sensors and feeds that into the GUI via RPC calls. Again with little documentation and examples that are unclear or not relevant I managed to work that issue out, now can send ints and strings and juggle any info between the 2 cores like a ninja very clean and no 'junk' data in the serial...
BUT, for the love of God, I cannot get any fonts to work, it was an issue that I tried to fix first, but was wasting days going around in circles looking at examples, using chat GPT, using Gemini AI, reading all the documentation on LVGL website, I just moved on to get everything else in order and just come back to this font issue later.. Well, now is that later, and STILL cant get anywhere with changing a font size. Such a simple thing, but totally complicated to implement.
What I have tried...
The basic instuctions to change the font sizes in LVGL is to go to the lv_font_template.h file located in the lvgl folder, and edit it to enable the font sizes you need to use.
Some way down the file there is a FONT USAGE section, and all the Montserrat fonts are listed here with a 0 next to them. Like so:
#define LV_FONT_MONTSERRAT_14 1
#define LV_FONT_MONTSERRAT_16 0
#define LV_FONT_MONTSERRAT_18 0
#define LV_FONT_MONTSERRAT_20 1
I go ahead and change the sizes I need to 1 and then save the file as lv_conf.h
Go to complile my sketch, and get the error: undefined reference to `lv_font_montserrat_20'
I look more carefully at the lv_conf.h file and at the top there are some instructions:
/*
* Copy this file as `lv_conf.h`
* 1. simply next to the `lvgl` folder
* 2. or any other places and
* - define `LV_CONF_INCLUDE_SIMPLE`
* - add the path as include path
*/
/* clang-format off */
#if 0 /*Set it to "1" to enable content*/
OK, so change that 0 to a 1 to enable content, and should work. Nope, same error.
Next attempt at this issue, I try to upload a custom font, using the online font converter found on the LVGL website. The converter lets you upload a font and spits out a .c file that you then need to define in your sketch. But after doing that, the .c file it gives is riddled with errors, I forgot what those errors were, but it looked numerous and not the real issue.
So then I tried to define the fonts directly, in the lvgl/src/font folder there are all the montserrat font files, like so: lv_font_montserrat_20.c (from size 8 going up to like 48 in increments of 2). I tried to use:
#define LV_FONT_DECLARE(lv_font_montserrat_20)
#include "lv_font_montserrat_20.h" (a header file i wrote to define the font)
extern const lv_font_t lv_font_montserrat_20;
even tried to copy the .c font file into my sketch folder and direct include paths to it, asking AI chats for ideas, all saying things I've already tried and for me to check the documentation....
I am frustrated the amount of time I have spent on trying to get a larger font size, and there is a serious lacking of information on this so is this working for everyone else? Or no one has an answer? A lot of what I read is Arduino releasing things too early or without proper testing or things half working correctly, so is this just another thing we just have to wait for whoever to update? Even if there's no answer to this issue, can I please cure my insanity knowing others have the same problem and it's not just me!