From cd16b7b00a090ab2ef90dcafa408b96547b45ebe Mon Sep 17 00:00:00 2001 From: Riley Nielsen Date: Sun, 1 Sep 2024 18:26:08 -0700 Subject: [PATCH 1/3] fix display of degree symbol (+ other symbols) --- src/graphics/Screen.h | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/graphics/Screen.h b/src/graphics/Screen.h index 1b6f541be..bb5d947e3 100644 --- a/src/graphics/Screen.h +++ b/src/graphics/Screen.h @@ -309,7 +309,7 @@ class Screen : public concurrency::OSThread static char customFontTableLookup(const uint8_t ch) { // UTF-8 to font table index converter - // Code form http://playground.arduino.cc/Main/Utf8ascii + // Code from http://playground.arduino.cc/Main/Utf8ascii static uint8_t LASTCHAR; static bool SKIPREST; // Only display a single unconvertable-character symbol per sequence of unconvertable characters @@ -322,13 +322,19 @@ class Screen : public concurrency::OSThread uint8_t last = LASTCHAR; // get last char LASTCHAR = ch; -#if defined(OLED_PL) - - switch (last) { // conversion depending on first UTF8-character + switch(last) { case 0xC2: { SKIPREST = false; return (uint8_t)ch; } + } + + // We want to strip out prefix chars for two-byte char formats + if (ch == 0xC2) + return (uint8_t)0; + +#if defined(OLED_PL) + case 0xC3: { if (ch == 147) @@ -365,11 +371,6 @@ class Screen : public concurrency::OSThread #if defined(OLED_UA) || defined(OLED_RU) - switch (last) { // conversion depending on first UTF8-character - case 0xC2: { - SKIPREST = false; - return (uint8_t)ch; - } case 0xC3: { SKIPREST = false; return (uint8_t)(ch | 0xC0); From 234e652a0753e56bdace676ebe28e44f9600cb27 Mon Sep 17 00:00:00 2001 From: Riley Nielsen Date: Sun, 1 Sep 2024 20:40:56 -0700 Subject: [PATCH 2/3] Fix switch --- src/graphics/Screen.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/graphics/Screen.h b/src/graphics/Screen.h index bb5d947e3..d5a2879cd 100644 --- a/src/graphics/Screen.h +++ b/src/graphics/Screen.h @@ -335,6 +335,7 @@ class Screen : public concurrency::OSThread #if defined(OLED_PL) + switch(last) { case 0xC3: { if (ch == 147) @@ -371,6 +372,7 @@ class Screen : public concurrency::OSThread #if defined(OLED_UA) || defined(OLED_RU) + switch(last) { case 0xC3: { SKIPREST = false; return (uint8_t)(ch | 0xC0); From 719faf4f970eaddf9feb97ed36110a507a0ad805 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Mon, 2 Sep 2024 10:16:32 +0200 Subject: [PATCH 3/3] trunk fmt --- src/graphics/Screen.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/graphics/Screen.h b/src/graphics/Screen.h index d5a2879cd..021b11bda 100644 --- a/src/graphics/Screen.h +++ b/src/graphics/Screen.h @@ -322,7 +322,7 @@ class Screen : public concurrency::OSThread uint8_t last = LASTCHAR; // get last char LASTCHAR = ch; - switch(last) { + switch (last) { case 0xC2: { SKIPREST = false; return (uint8_t)ch; @@ -335,7 +335,7 @@ class Screen : public concurrency::OSThread #if defined(OLED_PL) - switch(last) { + switch (last) { case 0xC3: { if (ch == 147) @@ -372,7 +372,7 @@ class Screen : public concurrency::OSThread #if defined(OLED_UA) || defined(OLED_RU) - switch(last) { + switch (last) { case 0xC3: { SKIPREST = false; return (uint8_t)(ch | 0xC0);