1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-28 07:03:00 +08:00

lv_txt_get_width: trim the last letter space

This commit is contained in:
Gabor Kiss-Vamosi 2018-05-26 09:48:26 +02:00
parent 5fedbdf414
commit 6a610949e9

View File

@ -199,6 +199,8 @@ lv_coord_t lv_txt_get_width(const char * txt, uint16_t length,
width += letter_space;
}
width -= letter_space; /*Trim the last letter space because there is no letter after it*/
/*Trim closing spaces. Important when the text is aligned to the middle */
for(i = length - 1; i > 0; i--) {
if(txt[i] == ' ') {