From 429af69c608bc485e9d9a8f9eed9bacd5bc809da Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 17 May 2024 19:25:33 -0500 Subject: [PATCH] Fix utf-8 (Cyrillic) on DOGLCD See #27097 --- Marlin/src/lcd/lcdprint.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Marlin/src/lcd/lcdprint.cpp b/Marlin/src/lcd/lcdprint.cpp index ea833f53a1df5..9d954c72ad471 100644 --- a/Marlin/src/lcd/lcdprint.cpp +++ b/Marlin/src/lcd/lcdprint.cpp @@ -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 == '*') { @@ -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 (wc > 255 && prop == 2) { + // Wide glyph support incomplete + *((uint16_t*)o) = wc; + ++o; + } else - while (psc != p) *o++ = read_byte_rom(psc++); + *o = wc; + ++o; *o = '\0'; n--; }