OLED Cyrillic Support for v1.3 (#1640)
* Extended ASCII codes and cyrillic support (cherry picked from commit e977840805d3d14260f917b03a2db957d52ec657) * Fixed `ё`, `Ё` letters (cherry picked from commit 2f4a2ccb2f50cab879f4a1002215c176a435bae7) * Fixed `customFontTableLookup` execution flow (cherry picked from commit 377f909f36201ba6f7fe4511f631f54b8cb2ab3e) * [OLED] Specifying the language by defining it in `platformio.ini` (cherry picked from commit ddd8132b24095556e0b3cd17f1a3b3458bc15c4e) * [OLED] localization guide (cherry picked from commit a3267c886f36731c8f123636162a8c2a752a80c4) * [OLED] Cyrillic support Localization guide has been moved to https://github.com/meshtastic/Meshtastic/tree/master/docs/developers/Firmware https://meshtastic.org/docs/developers/Firmware/oled-l10n-guide Co-authored-by: Thomas Göttgens <tgoettgens@gmail.com> Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
This commit is contained in:
co-authored by
GitHub
Thomas Göttgens
Ben Meadors
parent
285ba9639e
commit
cb3010b58c
+15
-2
@@ -212,7 +212,7 @@ class Screen : public concurrency::OSThread
|
||||
uint8_t last = LASTCHAR; // get last char
|
||||
LASTCHAR = ch;
|
||||
|
||||
switch (last) { // conversion depnding on first UTF8-character
|
||||
switch (last) { // conversion depending on first UTF8-character
|
||||
case 0xC2: {
|
||||
SKIPREST = false;
|
||||
return (uint8_t)ch;
|
||||
@@ -221,10 +221,23 @@ class Screen : public concurrency::OSThread
|
||||
SKIPREST = false;
|
||||
return (uint8_t)(ch | 0xC0);
|
||||
}
|
||||
// map UTF-8 cyrillic chars to it Windows-1251 (CP-1251) ASCII codes
|
||||
// note: in this case we must use compatible font - provided ArialMT_Plain_10/16/24 by 'ThingPulse/esp8266-oled-ssd1306' library
|
||||
// have empty chars for non-latin ASCII symbols
|
||||
case 0xD0: {
|
||||
SKIPREST = false;
|
||||
if (ch == 129) return (uint8_t)(168); // Ё
|
||||
if (ch > 143 && ch < 192) return (uint8_t)(ch + 48);
|
||||
}
|
||||
case 0xD1: {
|
||||
SKIPREST = false;
|
||||
if (ch == 145) return (uint8_t)(184); // ё
|
||||
if (ch > 127 && ch < 144) return (uint8_t)(ch + 112);
|
||||
}
|
||||
}
|
||||
|
||||
// We want to strip out prefix chars for two-byte char formats
|
||||
if (ch == 0xC2 || ch == 0xC3 || ch == 0x82)
|
||||
if (ch == 0xC2 || ch == 0xC3 || ch == 0x82 || ch == 0xD0 || ch == 0xD1)
|
||||
return (uint8_t)0;
|
||||
|
||||
// If we already returned an unconvertable-character symbol for this unconvertable-character sequence, return NULs for the
|
||||
|
||||
Reference in New Issue
Block a user