ESP32 LVGL example with cyrillic fonts


I really liked the LVGL demo, but I did not find how and in what way to use Cyrillic fonts.

What MCU/Processor/Board and compiler are you using?

ESP-IDF + Windows 10
ESP32 Wroover + GC9A01

What LVGL version are you using?


What do you want to achieve?

I want to learn how to print and substitute different Cyrillic fonts

What have you tried so far?

I tried to do font translation, but I couldn’t include it in the demo. If anyone has a working example how to do this.

Code to reproduce

Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.

The code block(s) should be formatted like:

   lv_obj_t * label2 = lv_label_create(lv_scr_act(), NULL);
//  lv_label_set_long_mode(label2, LV_LABEL_LONG_SROLL_CIRC);     /*Circular scroll*/
   lv_obj_set_width(label2, 150);

 // static lv_style_t label_shadow_style;
//   lv_style_init(&label_shadow_style);

//  lv_style_set_text_font(&style_common, LV_STATE_DEFAULT, &lv_font_montserrat_16_compr_az);

 //   lv_style_set_text_font(&bigStyle ,LV_STATE_DEFAULT, &montserrat-extrabold_20_rus);

 // lv_font_t * my_font;
 // my_font = lv_font_load("F:/Distr/ESP32/Espressif/frameworks/esp-idf-v4.4/components/lvgl/src/font/montserrat-extrabold_20_rus.c");

       /*Use the font*/
      /*Free the font if not required anymore*/
      // lv_font_free(my_font);

       lv_label_set_align(label2, LV_LABEL_ALIGN_CENTER);
       lv_label_set_text(label2, LV_SYMBOL_OK LV_SYMBOL_WIFI LV_SYMBOL_PLAY);
       lv_label_set_text(label2, "It is Привет лунатики. ");
       lv_obj_align(label2, NULL, LV_ALIGN_CENTER, 0, 30);

I have not yet mastered the simulator and do not know how to use it.

Screenshot and/or video

If possible, add screenshots and/or videos about the current state.

The “buildin” fonts don’t have cyrilic characters. You need to rebuild fonts in converter and then use it.
For example select Montserrat-Medium.ttf as source and set 14’s size, type 0x20-0x7F,0xB0,0x2022 as range but add 0x410-0x44f,0x451. This will add Russian Cyrilic symbols.
Then select this font as font for you object


    lv_obj_set_style_text_font(label2, &lv_font_my_montserrat_14, LV_PART_MAIN);

Лень переводить на русский. Думаю понятно и так :slight_smile:

Yes, the option worked.
Спасибо. :slightly_smiling_face: