Skip to content

Commit

Permalink
Quick fix for string width calculation bug in u8g2
Browse files Browse the repository at this point in the history
This bug is better described in the upstream issue:
olikraus/u8g2#2588

Basically there can be minor alignment errors in menu text because of
how the position is calculated. This was not seen before, because it
pretty much requires the first character of the text to be narrow and
the text to span the full width of the display.
  • Loading branch information
dkonigsberg committed Feb 10, 2025
1 parent d71ad6d commit 299099f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions software/firmware/external/u8g2/csrc/u8g2_selection_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ 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);
str_width -= u8g2_GetXOffsetUTF8(u8g2, s); /* (DK) */

/* calculate delta d within the box */
d = 0;
Expand Down

0 comments on commit 299099f

Please sign in to comment.