I’m currently migrating my code to LittlevGL. Currently it is using two libraries for SSD1306 and ILI9341 for display control and I want to use lv_port_esp32 to only have a single library.
Doing this I already added the SSD1306 via I2C to lv_port_esp32 too, and will provide as a PR soon.
In my previous implementation I used a small 6x10 font for a SSD1306 controlled OLED 128x64 display which is working pretty good.
The font is based on Espressif esp-iot-solution an can be found here: ssd1306_fonts.c. I changed this font by cutting some bits, results are in 6x10 font.
How can I migrate this 6x10 font to LittlevGL? Is an instruction available on how to set up the minimum font file for LittlevGL, so that I can write a small converter?
Here you can see an example on how the font is looking on the display: Device example screen
I read the forum but didn’t found the answer or a similar 6x10 fixed width font.
The docs for adding a new font to lvgl is here: Add new font
From what i understand you must do this:
To declare the font in a file, use
To make the fonts globally available (like the builtin fonts), add them to
LV_FONT_CUSTOM_DECLARE in lv_conf.h .
On the lv_conf.h file search for the following section and add the font to make it globally available:
/* Optionally declare your custom fonts here.
* You can use these fonts as default font too
* and they will be available globally. E.g.
* #define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(my_font_1) \
Those directions explains how to convert a TTF font to LittlevGL’s font format. In this case, it sounds like @an-erd has an existing hex font which is not in TTF format, hence the online converter won’t work for them.
There is a HEX converter available here but it doesn’t appear that your font is using that format either. You may be able to adapt your fonts to work with that tool though.
I see, thanks for the clarification .
Thanks for your replies.
I made some tests with the Roboto font, small sizes and the LittlevGL font converter. The results are very fine, so I decided to just change the text alignment in my code and just use these Roboto, bpp 1, size 9 font.