Thai cannot be fully displayed

Description

I want to display Thai on the interface, but when Thai is displayed with consonants superimposed on vowels and tones, the tone cannot be fully displayed and will be mixed with vowels. How can I display it correctly?

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

I’m using the simulator

What LVGL version are you using?

9.0

What do you want to achieve?

Full display of Thai language

What have you tried so far?

I tried different fonts and text heights, but none of them worked

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_freetype_init(64,1,0);
    static lv_ft_info_t info;
    info.name = "/system/res/fonts/leelawdb.ttf";
    info.weight = 50;
    info.style = FT_FONT_STYLE_NORMAL;
    info.mem=NULL;
    if(!lv_ft_font_init(&info)) {
        printf("create failed.\n");
    }

    static lv_style_t style;
    lv_style_init(&style);
    lv_style_set_text_font(&style, info.font);

    lv_obj_t * label1 = lv_label_create(lv_scr_act());    
    lv_label_set_text(label1, "ทิ๋");
    lv_obj_set_width(label1, 100);   
    lv_obj_set_pos(label1, 100, 100);   
    lv_obj_add_style(label1, &style, 0);

    lv_obj_t * label2 = lv_label_create(lv_scr_act());    
    lv_label_set_text(label2, "ทิ");
    lv_obj_set_width(label2, 100);   
    lv_obj_set_pos(label2, 300, 100);   
    lv_obj_add_style(label2, &style, 0);

Screenshot and/or video

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

Have you tried converting the font to C array using the online font converter? I also had issues with polish characters, but specifying all symbols that I wanted to use made the font usable.

this is not the problem of font.

try HarfBuzz to tune the glyph. LVGL font engine is fully-grown now. @kisvegabor please think about use harfbuzz or refactor the lv_font_t struct. refactor the get_glyph_dsc interface.
do not just offer one letter and letter_next, offer the full string instead.

The LVGL font engine is not fully grown yet and using the full Harfbuzz for all text shaping is a terrible idea for embedded…

But you might be interested in this thread, that I started not long ago :slight_smile:

Btw, do you know a light weight Harfbuzz alternative?

You could try to compile Harfbuzz with the compile flag HB_TINY, but what this comes to and if it’s usable, I haven’t tested. But I think the lightest weight shaper is one where you can select languages/features as modules… emWin also has Arabic, Thai and Japanese as things you can enable separately.

1 Like