feat(span): support bidi for span (#7717)

Signed-off-by: liuhongchao <liuhongchao@xiaomi.com>
This commit is contained in:
红桃六
2025-02-20 10:18:17 +08:00
committed by GitHub
parent 377cc5aa80
commit 28f902d702
6 changed files with 200 additions and 26 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

+19
View File
@@ -498,4 +498,23 @@ void test_spangroup_set_right_align_on_overflow(void)
TEST_ASSERT_EQUAL_SCREENSHOT("widgets/span_10.png");
}
void test_spangroup_rtl_mode(void)
{
const char * message = "مرحبا بكم في LVGL.";
active_screen = lv_screen_active();
spangroup = lv_spangroup_create(active_screen);
lv_obj_set_style_outline_width(spangroup, 1, 0);
lv_obj_set_style_text_font(spangroup, &lv_font_dejavu_16_persian_hebrew, 0);
lv_obj_set_style_base_dir(spangroup, LV_BASE_DIR_RTL, 0);
lv_obj_set_size(spangroup, 300, lv_font_dejavu_16_persian_hebrew.line_height);
lv_spangroup_set_align(spangroup, LV_TEXT_ALIGN_LEFT);
lv_span_t * span = lv_spangroup_new_span(spangroup);
lv_span_set_text_static(span, message);
TEST_ASSERT_EQUAL_SCREENSHOT("widgets/span_11.png");
}
#endif