mirror of
https://github.com/olikraus/u8g2.git
synced 2025-05-09 00:02:39 +08:00
Subtract the offset included in the string width calculation
When balanced string width calculation is enabled, the offset of the first character is included in the string width value. This offset is not used when drawing the string as part of a selection list, so this behavior throws off the text alignment. Fix #2588
This commit is contained in:
parent
df86c4b954
commit
867923a0f8
@ -63,6 +63,11 @@ void u8g2_DrawUTF8Line(u8g2_t *u8g2, u8g2_uint_t x, u8g2_uint_t y, u8g2_uint_t w
|
||||
/* calculate the width of the string in pixel */
|
||||
str_width = u8g2_GetUTF8Width(u8g2, s);
|
||||
|
||||
#ifdef U8G2_BALANCED_STR_WIDTH_CALCULATION
|
||||
/* subtract the first character offset added by the width calculation */
|
||||
str_width -= u8g2_GetXOffsetUTF8(u8g2, s);
|
||||
#endif
|
||||
|
||||
/* calculate delta d within the box */
|
||||
d = 0;
|
||||
if ( str_width < w )
|
||||
|
Loading…
x
Reference in New Issue
Block a user