fix(span): fix span incorrect max height calculation (#6243)

This commit is contained in:
Benign X
2024-05-20 21:34:32 +08:00
committed by GitHub
parent 64ebf19734
commit 9c7981215a
3 changed files with 5 additions and 4 deletions

View File

@@ -485,10 +485,10 @@ int32_t lv_spangroup_get_expand_height(lv_obj_t * obj, int32_t width)
uint32_t tmp_ofs = next_ofs;
uint32_t letter = lv_text_encoded_prev(&cur_txt[cur_txt_ofs], &tmp_ofs);
if(!(letter == '\0' || letter == '\n' || letter == '\r' || lv_text_is_break_char(letter))) {
tmp_ofs = 0;
letter = lv_text_encoded_next(&cur_txt[cur_txt_ofs + next_ofs], &tmp_ofs);
if(!(letter == '\0' || letter == '\n' || letter == '\r' || lv_text_is_break_char(letter))) {
uint32_t letter_next = lv_text_encoded_next(&cur_txt[cur_txt_ofs + next_ofs], NULL);
if(!(letter == '\0' || letter == '\n' || letter == '\r' || lv_text_is_break_char(letter) ||
lv_text_is_a_word(letter) || lv_text_is_a_word(letter_next))) {
if(!(letter_next == '\0' || letter_next == '\n' || letter_next == '\r' || lv_text_is_break_char(letter_next))) {
break;
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

View File

@@ -344,6 +344,7 @@ void test_spangroup_chinese_break_line(void)
TEST_ASSERT_EQUAL_SCREENSHOT("widgets/span_07.png");
lv_obj_set_style_text_font(spangroup, LV_FONT_DEFAULT, 0);
lv_freetype_font_delete(font);
}