Are there plan to import standard line-breaking algorithm?

The current text line-breaking has many issues in multilingual contexts, such as punctuation marks appearing at the beginning of a line. Does LVGL have plans to address this?

1 Like

Hi,

Please send a code snippet to reproduce the issue.

Please ignore the characters in the image that are not in the font library.

lv_obj_t * cz_label = lv_label_create(lv_scr_act());
    lv_label_set_text(cz_label,
                      "Antidisestablishmentarianism ANCS(Apple Notification Center Service)通知确实包含应用程序名称。当iOS设备将通知推送到配对的蓝牙设备(如智能手表)时,ANCS会传递一些关键信息,其中包括应用程序的名称(App Identifier),标题(Title),消息内容(Message),以及其他与通知相关的详细信息。这样,配对的设备就能根据这些信息来显示适当的通知内容。");
    lv_obj_set_style_text_font(cz_label, &lv_font_simsun_16_cjk, 0);
    lv_obj_set_width(cz_label, 160);
    lv_obj_align(cz_label, LV_ALIGN_TOP_LEFT, 5, 5);

1724659452755

Here are two issues:

  1. Long words are wrapped directly. Ideally, a hyphen should be added after the correct syllable, which is common in German. (However, this might require introducing libhyphen, which could be too resource-intensive.)
  2. Line breaks are occurring in inappropriate positions. For example, in this image, a Chinese punctuation mark appears at the beginning of a line. This might require an algorithm similar to UAX #14: Unicode Line Breaking Algorithm.
1 Like

Hyphening is really too resource hungry for us. However, I’ll keep it in mind when we rework the typesetting interface.

This standard is new to me. I’ll check it out.