The `bidi` and Persian/Arabic character settings are reversing the Arabic numerics

Hi all,

I have encountered a problem with the Bidi algorithm when using the following options:

#define LV_USE_BIDI 1

#define LV_USE_ARABIC_PERSIAN_CHARS 1

With both options enabled, Persian text is displayed correctly, but Persian/Arabic-Indic digits inside the string are reversed.

For example:

شنبه، ۱۵ مهر

is displayed as:

شنبه، ۵۱ مهر

If I disable the Bidi algorithm, the digit order is correct, but the Persian text is displayed in the wrong order.

I also encountered another issue when “LV_USE_ARABIC_PERSIAN_CHARS” is enabled. LVGL seems to convert the Persian digit “۲” (U+06F2) to “۰” (U+06F0).

For example, this string:

۱۲:۴۵

is displayed as:

۱۰:۴۵

I traced this to “ap_chars_map” and temporarily removed the Persian digits (۰–۹) from the map:

{206, 0x06F0, -1, 2, 0, {0, 0}}, // ۰

{207, 0x06F1, 0, 0, 0, {0, 0}}, // ۱

{208, 0x06F2, 0, 0, 0, {0, 0}}, // ۲

{209, 0x06F3, 0, 0, 0, {0, 0}}, // ۳

{210, 0x06F4, 0, 0, 0, {0, 0}}, // ۴

{211, 0x06F5, 0, 0, 0, {0, 0}}, // ۵

{212, 0x06F6, 0, 0, 0, {0, 0}}, // ۶

{213, 0x06F7, 0, 0, 0, {0, 0}}, // ۷

{214, 0x06F8, 0, 0, 0, {0, 0}}, // ۸

{215, 0x06F9, 0, 0, 0, {0, 0}}, // ۹

After removing these entries, the digit-conversion issue is fixed, but the Bidi issue remains: Persian digits are still displayed in reverse order.

So, in summary:

1. “LV_USE_BIDI = 1” + “LV_USE_ARABIC_PERSIAN_CHARS = 1”

  • Persian text: correct

  • Persian digits: reversed (“۱۵” → “۵۱”)

2. “LV_USE_BIDI = 0”

  • Persian digits: correct

  • Persian text: reversed

3. “LV_USE_ARABIC_PERSIAN_CHARS = 1”

  • Persian digit “۲” is incorrectly converted to “۰” in some cases.

Has anyone encountered this issue or know where the digit reordering happens in LVGL’s Bidi implementation?

Regards,

Ehsan