Help with custom icon

I’m making a gauge for a flight simulator.
I can’t figure out how to create my own icons for the file

lib\lvgl\src\font\lv_symbol_def.h

I want to draw an icon with slanted strokes, like this altimeter


Now I use the

LV_SYMBOL_BARS

symbol for my device

I use it in the code like this

// scale from 0 to 9 with a minus, for airfields below sea level
lv_roller_set_options(ui_Roller3, LV_SYMBOL_BARS "\n"
"0\n1\n2\n3\n4\n5\n6\n7\n8\n9", LV_ROLLER_MODE_INFINITE);

I found a rather confusing, at least for me, instruction:
https://docs.lvgl.io/master/details/main-components/font.html#adding-new-symbols
And as far as I understood it, you can only add a symbol through fonts, and the fonts must be from the FontAwesome sets, i.e. you can’t draw and add an icon yourself?
I would be grateful if someone could help me draw the icon I need and convert it.
For example, I tried to add an icon on the first try.
Found the symbol codes here:

Copied the symbol code BAR_CODE and added it to the lv_symbol_def.h file
It turned out like this

#if !defined LV_SYMBOL_BAR_CODE
#define LV_SYMBOL_BAR_CODE "\xef\x80\xaa"
#endif

I specified the symbol display in the project code, but the font was not detected on the device.
As far as I understand, in the lv_conf.h file, line 371, the default font is declared

#define LV_FONT_CUSTOM_DECLARE

and the font needed is fontawesome-webfont.ttf
I made the second attempt according to the instructions, found the symbol here

Copied it to the e562 font converter
Downloaded the font fontawesome-webfont.ttf, started converting and got an error about the symbol missing inside the font.

In general, I am confused and cannot figure out this process myself :roll_eyes:
I want to learn how to do this.
Thanks in advance to the community.

Cool , model or ULL ? For symbol read Font (lv_font) — LVGL documentation
or use images.

1 Like

Unfortunately I couldn’t figure it out, have you tried creating a new symbol yourself?

I didn’t understand your question. :grinning:

ULL i mean ultra light airplane or …
And creating symbols is based on existence in font, or create font first. Not simple.
Steps is writed for existed font symbol you see in font … export to c and compile into your project as described.
Font Awesome

1 Like

I’m currently testing it on a flight simulator, but it can also be used on ULL :grinning:

Could you help convert the symbol or suggest which programs to use to draw my own?

This is UNICODE , converter require 0xe562 entered in range not symbols
header require UTF EE 95 A2

1 Like

Please tell me how to determine the size?
I specified 8 pixels for testing and received a c-file

Road-barrier.c (2.9 KB)

What should I do with it?

To create a custom icon, draw it using a tool like FontForge and save it as a .ttf file. Convert this font to a C array with LVGL’s font converter, using the correct Unicode range (e.g., 0xe562). Include the .c file in your project and declare it in lv_conf.h to use your custom symbol.

2 Likes