lv_label_no_break: fixes

This commit is contained in:
Gabor Kiss-Vamosi
2018-07-25 06:12:05 +02:00
parent 1fa77fa5d7
commit 818cd278b2
3 changed files with 13 additions and 5 deletions

View File

@@ -195,10 +195,13 @@ lv_coord_t lv_txt_get_width(const char * txt, uint16_t length,
continue;
}
}
width += lv_font_get_width(font, letter);
width += letter_space;
}
/*If NO_BREAK is set and '\n' or '\r' found then ignore this letter */
if(((flag & LV_TXT_FLAG_NO_BREAK) == 0) || (letter != '\n' && letter != '\r')) {
width += lv_font_get_width(font, letter);
width += letter_space;
}
}
width -= letter_space; /*Trim the last letter space. Important if the text is center aligned */
}