Description
How to display some text using Hindi Fonts
What MCU/Processor/Board and compiler are you using?
I am testing this behavior on the Simulator
What LVGL version are you using?
8.3.11
What do you want to achieve?
Just wanted to display the text in the Hindi language. For example, as seen in the below screenshot, the space is not rendered properly, and the second text is also not correct.
“Hello World” text in Hindi is हैलो वर्ल्ड
, but it is not rendered properly.
What have you tried so far?
Read forums but couldn’t make this simple program work.
Code to reproduce
I use the LVGL simulator project and then used Square Line Studio to convert fonts, and tried to display it on the label.
The code block(s) should be formatted like:
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLine, int nCmdShow)
{
/*Initialize LittlevGL*/
lv_init();
/*Initialize the HAL for LittlevGL*/
lv_win32_init(hInstance, SW_SHOWNORMAL, 800, 480, NULL);
/*Output prompt information to the console, you can also use printf() to print directly*/
LV_LOG_USER("LVGL initialization completed!");
/*Run the demo*/
// lv_demo_widgets();
ui_init();
while(!lv_win32_quit_signal) {
/* Periodically call the lv_task handler.
* It could be done in a timer interrupt or an OS task too.*/
lv_task_handler();
usleep(10000); /*Just to let the system breath*/
}
return 0;
}
and then the ui_init
function, which is generated using Square Line Studio
is as below.
void ui_Screen1_screen_init(void)
{
ui_Screen1 = lv_obj_create(NULL);
lv_obj_clear_flag(ui_Screen1, LV_OBJ_FLAG_SCROLLABLE); /// Flags
ui_Label1 = lv_label_create(ui_Screen1);
lv_obj_set_width(ui_Label1, 800);
lv_obj_set_height(ui_Label1, 100);
lv_obj_set_align(ui_Label1, LV_ALIGN_CENTER);
lv_label_set_long_mode(ui_Label1, LV_LABEL_LONG_SCROLL);
lv_label_set_text(ui_Label1, "हैलो वर्ल्ड");
lv_obj_set_style_text_align(ui_Label1, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_text_font(ui_Label1, &ui_font_Akshar40, LV_PART_MAIN | LV_STATE_DEFAULT);
}
Screenshot and/or video
I am using Akshar font, If use this font in Word, the document works fine, as shown below. (I don’t know if this is the correct criteria to judge a font)
So basically I have two problems, one is space not rendered and the second is why the second word is not rendered properly.
I converted this “Akshar” font using Square Line Studio, as shown below.
As shown above, in the “font manager” screen of Square Line Studio, I converted the Symbol also for space, but it doesn’t work.
The second problem of the second word is not rendered properly, I can’t type it properly in the Square Line Studio itself, as shown below.
So even in Square Line Studio, it is rendered strangely, but in “code” it is written properly.
Either I am doing something wrong or don’t know, please help me to fix this problem, or LVGL doesn’t support the Hindi language?
The following is the font that I am using. Thanks
Akshar-Unicode.zip (249.6 KB)