Merge pull request #4610 from Coloradohusky/fix_chars

Fix display of certain Unicode symbols
This commit is contained in:
Thomas Göttgens 2024-09-02 10:16:47 +02:00 committed by GitHub
commit 1fc6cc2d6c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -309,7 +309,7 @@ class Screen : public concurrency::OSThread
static char customFontTableLookup(const uint8_t ch) static char customFontTableLookup(const uint8_t ch)
{ {
// UTF-8 to font table index converter // 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 uint8_t LASTCHAR;
static bool SKIPREST; // Only display a single unconvertable-character symbol per sequence of unconvertable characters static bool SKIPREST; // Only display a single unconvertable-character symbol per sequence of unconvertable characters
@ -322,13 +322,20 @@ class Screen : public concurrency::OSThread
uint8_t last = LASTCHAR; // get last char uint8_t last = LASTCHAR; // get last char
LASTCHAR = ch; LASTCHAR = ch;
#if defined(OLED_PL) switch (last) {
switch (last) { // conversion depending on first UTF8-character
case 0xC2: { case 0xC2: {
SKIPREST = false; SKIPREST = false;
return (uint8_t)ch; 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)
switch (last) {
case 0xC3: { case 0xC3: {
if (ch == 147) if (ch == 147)
@ -365,11 +372,7 @@ class Screen : public concurrency::OSThread
#if defined(OLED_UA) || defined(OLED_RU) #if defined(OLED_UA) || defined(OLED_RU)
switch (last) { // conversion depending on first UTF8-character switch (last) {
case 0xC2: {
SKIPREST = false;
return (uint8_t)ch;
}
case 0xC3: { case 0xC3: {
SKIPREST = false; SKIPREST = false;
return (uint8_t)(ch | 0xC0); return (uint8_t)(ch | 0xC0);