Skip to content

Commit

Permalink
Fix utf-8 (Cyrillic) on DOGLCD
Browse files Browse the repository at this point in the history
See #27097
  • Loading branch information
thinkyhead committed May 18, 2024
1 parent 2fd7c2b commit 3f18144
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
3 changes: 2 additions & 1 deletion Marlin/src/lcd/dogm/marlinui_DOGM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -593,9 +593,10 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
}

void MenuItem_confirm::draw_select_screen(FSTR_P const yes, FSTR_P const no, const bool yesno, FSTR_P const fpre, const char * const string/*=nullptr*/, FSTR_P const fsuf/*=nullptr*/) {
const u8g_uint_t prop = USE_WIDE_GLYPH ? 2 : 1;
ui.draw_select_screen_prompt(fpre, string, fsuf);
if (no) draw_boxed_string(1, LCD_HEIGHT - 1, no, !yesno);
if (yes) draw_boxed_string(LCD_WIDTH - (utf8_strlen(yes) * (USE_WIDE_GLYPH ? 2 : 1) + 1), LCD_HEIGHT - 1, yes, yesno);
if (yes) draw_boxed_string(LCD_WIDTH - (utf8_strlen(yes) * prop + 1), LCD_HEIGHT - 1, yes, yesno);
}

#if HAS_MEDIA
Expand Down
11 changes: 8 additions & 3 deletions Marlin/src/lcd/lcdprint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ lcd_uint_t expand_u8str_P(char * const outstr, PGM_P const ptpl, const int8_t in
int8_t n = maxlen;
while (n > 0) {
lchar_t wc;
uint8_t *psc = (uint8_t *)p;
p = get_utf8_value_cb(p, read_byte_rom, wc);
if (!wc) break;
if (wc == '{' || wc == '~' || wc == '*') {
Expand Down Expand Up @@ -90,9 +89,15 @@ lcd_uint_t expand_u8str_P(char * const outstr, PGM_P const ptpl, const int8_t in
}
else {
if (wc == '@')
*o++ = AXIS_CHAR(ind);
*o = AXIS_CHAR(ind);
else if (USE_WIDE_GLYPH && wc > 255) {
// Wide glyph support incomplete
*((uint16_t*)o) = wc;
++o;
}
else
while (psc != p) *o++ = read_byte_rom(psc++);
*o = wc;
++o;
*o = '\0';
n--;
}
Expand Down

0 comments on commit 3f18144

Please sign in to comment.