I am trying to display Arabic text on screen. I am using PC simulator. According to your instruction, I applied the following procedure:
convert font into binary format using lv_font_conv with this command: (size is ~12KB)
npx lv_font_conv --size 16 --format bin --bpp 4 --font c:/e-ws/simpo.ttf -r 0x20-0x7f -r 0x600-0x6ff -r 0xfe00-0xfeff -o c:/e-ws/simpo_16.bin
I verified the imported fonts using –format dump switch.
Then, in my initialization routing, I added:
lv_font_t * my_font; // <-- this is a global variable
lv_port_fs_init();
my_font = lv_font_load("c:/e-ws/simpo_16.bin");
And modified lv_config.h with:
#define LV_USE_BIDI 1
#define LV_USE_ARABIC_PERSIAN_CHARS 1
And finally, wrote a code to display the Arabic text:
static lv_style_t style2;
lv_style_init(&style2);
lv_obj_t * label2 = lv_label_create(lv_scr_act(), NULL);
lv_obj_add_style(label2, LV_OBJ_PART_MAIN, &style2);
lv_style_set_text_font(&style2, LV_STATE_DEFAULT, my_font);
lv_obj_set_style_local_text_color(label2, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_RED);
lv_obj_set_width(label2, 128);
lv_obj_align(label2, NULL, LV_ALIGN_CENTER, 0, 0);
lv_label_set_text(label2, "احمد");
//lv_label_set_text(label2, "ahmad");
The English text is displayed correctly, but not the Arabic’s.
Did I miss any configuration or initialization step?
Thanks.