Kaynağa Gözat

Finally fixed UTF8 to CP1251 conversion.

Vladimir N. Shilov 1 yıl önce
ebeveyn
işleme
51c6bbf086
1 değiştirilmiş dosya ile 18 ekleme ve 12 silme
  1. 18 12
      lib/st7735/st7735.c

+ 18 - 12
lib/st7735/st7735.c

@@ -286,18 +286,16 @@ void ST7735_WriteString(uint16_t x, uint16_t y, const char* str, FontDef font, u
         case 0xD0: {
           str ++;
           ch = *str;
-          if (ch == 0x81) { // Ё
-            ch = 0xA8;
-          } else if (ch == 0x83) { // Ѓ
-            ch =  0xa5;
+          if (ch >= 0x90 && ch <= 0xBF) {
+            ch += 0x30;
           } else if (ch == 0x84) { // Є
             ch =  0xaa;
           } else if (ch == 0x86) { // І
             ch =  0xb2;
           } else if (ch == 0x87) { // Ї
             ch =  0xaf;
-          } else if (ch >= 0x90 && ch <= 0xBF) {
-            ch += 0x30;
+          } else if (ch == 0x81) { // Ё
+            ch = 0xA8;
           } else {
             ch =  '.';
           }
@@ -306,23 +304,31 @@ void ST7735_WriteString(uint16_t x, uint16_t y, const char* str, FontDef font, u
         case 0xD1: {
           str ++;
           ch = *str;
-          if (ch == 0x91) { // ё
-            ch = 0xB8;
-          } else if (ch == 0x93) { // ѓ
-            ch =  0xb4;
+          if (ch >= 0x7E && ch <= 0x8F) {
+            ch += 0x70;
           } else if (ch == 0x94) { // є
             ch =  0xba;
           } else if (ch == 0x96) { // і
             ch =  0xb3;
           } else if (ch == 0x97) { // ї
             ch =  0xbf;
-          } else if (ch >= 0x7E && ch <= 0x8F) {
-            ch += 0x70;
+          } else if (ch == 0x91) { // ё
+            ch = 0xB8;
           } else {
             ch =  '.';
           }
           break;
         }
+        case 0xD2: {
+          str ++;
+          ch = *str;
+          if (ch == 0x90) { // Ґ
+            ch =  0xa5;
+          } else if (ch == 0x91) { // ґ
+            ch =  0xb4;
+          }
+          break;
+        }
       }
     }
 #endif /* USE_UTF8 */