mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-14 06:42:58 +08:00
lv_txt_get_width: don't trim the closing spaces because it would result unwanted text wrap
This commit is contained in:
parent
bcab0ffcc6
commit
8a7a966a7b
@ -201,16 +201,6 @@ lv_coord_t lv_txt_get_width(const char * txt, uint16_t length,
|
||||
|
||||
|
||||
width -= letter_space; /*Trim the last letter space. Important if the text is center aligned */
|
||||
|
||||
/*Trim closing spaces. Important when the text is aligned to the middle */
|
||||
for(i = length - 1; i > 0; i--) {
|
||||
if(txt[i] == ' ' || txt[i] == '\n' || txt[i] == '\r') {
|
||||
width -= lv_font_get_width(font, txt[i]);
|
||||
width -= letter_space;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return width;
|
||||
|
Loading…
x
Reference in New Issue
Block a user