Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use lv_font_conv to convert Chinese display garbled code #124

Open
flashsim opened this issue Oct 29, 2024 · 1 comment
Open

Use lv_font_conv to convert Chinese display garbled code #124

flashsim opened this issue Oct 29, 2024 · 1 comment

Comments

@flashsim
Copy link

I use LVGL 9.1.1 version. After using the official online and offline font conversion tools to convert a Chinese character, the demo example shows garbled characters on the LCD. I don't know where the error is. Can you give me some suggestions? thinks

The command to use the offline conversion tool is:
lv_font_conv --no-compress --format bin --font QingNiaoHuaGuangJianMeiHei-2.ttf -o my_font-guo.bin --bpp 4 --size 30 --symbols "国"

I used the online method to save the bin file and compared it with the bin file generated above. The generated bin files are the same.
the test code is:
void lvgl_font_test(void)
{
lv_font_t * font_18 = lv_binfont_create("0:my_font.bin");
if (font_18 == NULL)
{
printf("font load failed \r\n");
return;
}

lv_obj_t *label_name = lv_label_create(lv_screen_active());
lv_label_set_text(label_name, "国");
lv_obj_set_style_text_color(label_name, lv_color_hex(0x003a57), LV_PART_MAIN);
lv_obj_set_style_text_font(label_name, font_18, LV_PART_MAIN);
lv_obj_align(label_name, LV_ALIGN_CENTER, 0, 0);

lv_binfont_destroy(font_18);

}

@Christer-Ekholm
Copy link

My first try debugging test would be

lv_font_conv --no-compress --format bin --font QingNiaoHuaGuangJianMeiHei-2.ttf -o my_font-guo.bin --bpp 4 --size 30 --r 0x56FD

lv_label_set_text(label_name, u8"\u56FD");

I am not sure if those UTF codes are correct because I have worked so little with those.
I am newer trusting encodings of editors and consoles so I would try numerical values first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants