Persian/Arabic Font Issue in LVGL Pro

Description

I am having a Persian/Arabic font issue specifically in the LVGL Pro Editor Preview/Simulator.

I believe the problem may be related to the “lv_conf.h” configuration used by the LVGL Pro Editor Preview.

I am using:

- LVGL Pro Editor

- LVGL v9.5.0

- Windows

- Preview/Simulator

- STM32H743 target project

Default DejaVu Persian/Hebrew Font

I enabled the built-in Persian/Hebrew DejaVu font in “lv_conf.h”.

The “lv_conf.h” file I edited is located at:

“C:\Users\AmirBG\AppData\Roaming\lvgl-editor\resources\v9.5.0\libs\include\lvgl\lv_conf.h”

I enabled:

“LV_FONT_DEJAVU_16_PERSIAN_HEBREW”

However, when I try to use this font in the LVGL Pro Editor Preview/XML, the font is not recognized.

LVGL reports that the font cannot be found.

This makes me suspect that the “lv_conf.h” file I edited may not be the configuration file actually used by the LVGL Pro Editor Preview/Simulator, or that the font is not being registered with the XML font system.

Important Observation: Vazir Works Differently

I also tested the Vazir font.

When I add/register Vazir, LVGL can find the font by its name.

For example, when I use:

“Vazir”

the XML system can recognize the font.

However, the built-in DejaVu Persian/Hebrew font does not appear to be recognized in the same way, even though:

“LV_FONT_DEJAVU_16_PERSIAN_HEBREW”

is enabled in “lv_conf.h”.

This is the important difference I am trying to understand.

The problem is therefore not simply that “Persian fonts do not work”.

The Preview can recognize a custom font such as Vazir, while the built-in Persian/Hebrew DejaVu font that is enabled through “lv_conf.h” is not found by the XML/Preview system.

Persian Rendering Problem

When I use Vazir:

- English/Latin characters are rendered correctly.

- The font itself can be found by the XML system.

However, Persian text still has problems with:

- RTL layout

- Persian character joining

- Proper contextual forms of Persian/Arabic characters

For example:

“سلام دنیا”

- «ا‌ی‌ن‌د م‌ا‌ل‌س»

does not appear as expected in the Preview.

My Main Questions

1. Is this the correct “lv_conf.h”?

I edited:

“C:\Users\AmirBG\AppData\Roaming\lvgl-editor\resources\v9.5.0\libs\include\lvgl\lv_conf.h”

Is this actually the correct “lv_conf.h” that is used by the LVGL Pro Editor Preview/Simulator?

If not, where is the correct configuration file that should be edited?

2. What is the correct configuration?

What is the correct configuration required to enable the built-in Persian/Hebrew DejaVu font in LVGL Pro Editor?

For example, should I only enable:

“LV_FONT_DEJAVU_16_PERSIAN_HEBREW”

or are there additional font-related settings that must also be enabled?

3. How should the built-in font be referenced from XML?

If “LV_FONT_DEJAVU_16_PERSIAN_HEBREW” is enabled, how should this font be referenced from LVGL XML?

Does enabling the font automatically register it with the XML font system, or does it need to be explicitly registered with a font name?

4. Why does Vazir work differently?

Why can the Preview/XML system recognize the custom Vazir font when it is added, while the built-in DejaVu Persian/Hebrew font enabled through “lv_conf.h” is not found?

Is there a difference between:

- fonts compiled into LVGL through “lv_conf.h”

- fonts explicitly registered with the XML system

- fonts provided by LVGL Pro Editor

5. Is this a Preview/Simulator issue?

Could this be a limitation or bug in the LVGL Pro Editor Preview/Simulator, where the Preview uses a different “lv_conf.h” or font registration mechanism than the generated LVGL project?

I would like to know the correct way to configure the Preview so that the built-in Persian/Arabic font is actually available to the XML system.

6. Persian/Arabic shaping and RTL

After the font is correctly detected, is any additional configuration required for:

- Persian/Arabic character shaping

- Character joining

- Contextual glyph selection

- RTL text layout

- Right alignment

Or is the “LV_FONT_DEJAVU_16_PERSIAN_HEBREW” option supposed to handle these features by itself?

Summary

The main issue I am trying to solve is:

I enabled “LV_FONT_DEJAVU_16_PERSIAN_HEBREW” in the “lv_conf.h” located inside the LVGL Pro Editor resources, but the LVGL Pro Editor Preview/XML system does not recognize the built-in Persian/Hebrew font. A custom font such as Vazir can be recognized when explicitly added.

I updated the LVGL configuration using lv_conf_windows.defaults and added the following options:

LV_USE_BIDI                    1
LV_USE_ARABIC_PERSIAN_CHARS    1
LV_FONT_DEJAVU_16_PERSIAN_HEBREW 1
LV_BIDI_BASE_DIR_DEF LV_BASE_DIR_AUTO

I also tested the configuration without LV_BIDI_BASE_DIR_DEF, but the issue still persists.

At this point, I am still unsure about how the built-in DejaVu 16 Persian/Hebrew font should be referenced in LVGL XML. Specifically:

  • What is the correct font name to use in the XML?

  • Does the font need to be registered or defined globally in the XML before it can be used?

  • How should I reference this built-in font using style_text_font?

I am also still having the same problem with fonts that I installed manually. English text is rendered correctly, but Persian text is displayed with the characters separated from each other and aligned from left to right.

I also tried using:

style_base_dir="rtl"

For example, this is the screen I am currently testing:

<screen>
    <view
        extends="lv_obj"
        width="800"
        height="480"
        style_bg_color="0x101820"
        style_bg_opa="255"
        style_base_dir="rtl">

        <lv_label
            x="29"
            y="183"
            width="800"
            height="60"
            text="hello world"
            style_text_font="Vazir"
            style_text_color="0xFFFFFF"
            style_text_align="center"
            style_bg_color="0xFF0000"
            style_bg_opa="255"
            translation_tag=""
            text_selection_start="0"
        />

        <lv_label
            x="33"
            y="73"
            width="800"
            height="60"
            text="سلام دنیا"
            style_text_font="Vazir"
            style_text_color="0xFFFFFF"
            style_text_align="center"
            style_bg_color="0xFF0000"
            style_bg_opa="255"
            translation_tag=""
            text_selection_start="0"
        />

    </view>
</screen>

The English text is displayed correctly, but the Persian text still appears with disconnected characters and incorrect left-to-right ordering.

I would like to understand whether the problem is related to the font registration, the LVGL XML font naming/lookup mechanism, the BiDi/Arabic shaping configuration, or the way RTL is being applied in the XML.

Hi @Amirbgr , thank you to open this topic.

The lv_conf_windows.defaults file will be used in the simulator.

Have you already tried simulating this screen?

Dear halyssonJr,

Thank you very much for your response.

Yes, I tested it, but unfortunately, it was not successful.

I also discussed this issue with a friend, and apparently, similar problems can occur in software such as Adobe Premiere and other applications when handling Persian/Arabic text. In some cases, the issue can be fixed by using online text conversion tools that change the text encoding or character format, such as:

www.timecode.ir/font-converter/

I tried this tool, and that worked for me.

At this point, I only have two remaining questions:

  1. Is this a bug in LVGL Pro Editor? If so, are there any known workarounds or solutions similar to the approach mentioned above, such as converting the text before using it?

  2. How can I use the default font LV_FONT_DEJAVU_16_PERSIAN_HEBREW in LVGL Pro Editor?

Thank you again for your help. I really appreciate your support.

This issue has been fully resolved.

The problem was related to the LVGL Pro Editor preview. Persian and Arabic text were rendered incorrectly inside the LVGL Pro Editor itself. The issue could be partially worked around using the text-conversion tools mentioned earlier.

However, after running the generated UI on the actual microcontroller, Persian and Arabic text were rendered correctly without requiring those workarounds.

This indicates that the problem is most likely a bug or limitation in the LVGL Pro Editor preview/rendering engine, rather than an issue with LVGL itself or the generated code.

Hi @Amirbgr

The problem is that these settings are not enabled for the editor preview

I’ll check internally about enabling these for a future release

Hi, @Amirbgr. I’m William, the team lead for Pro. We are enabling:

LV_USE_BIDI 1
LV_USE_ARABIC_PERSIAN_CHARS 1
LV_FONT_DEJAVU_16_PERSIAN_HEBREW 1
LV_BIDI_BASE_DIR_DEF LV_BASE_DIR_AUTO

in the Editor preview. It will be released next week.