Page 1 of 1

esp32 t-display + cyrillic

Posted: Sun Feb 07, 2021 11:03 pm
by chiffa
Hello! It's need to display some cyrillic-text (russian and ukraine) on this display. I try to use font with this charters from here:
https://github.com/board707/DMD_STM32/t ... /gfx_fonts and use it:

Code: Select all

#include "fonts/GlametrixLight12pt7b.h";

TFT_eSPI tft = TFT_eSPI();

char *utf8rus_P(const char *source)
{
  char m[2] = { '0', '\0' };
  int j = 0;
  unsigned char n = 1;

  strcpy(target, "");

  while (1) {
    n = pgm_read_byte(source); source++;

    if (n >= 0xC0) {
      switch (n) {
        case 0xD0: {
          n = pgm_read_byte(source); source++;

          if (n == 0x81) { n = 0xA8; break; }
          if (n >= 0x90 && n <= 0xBF) n = n + 0x30;
          break;
        }
        case 0xD1: {
          n = pgm_read_byte(source); source++;

          if (n == 0x91) { n = 0xB8; break; }
          if (n >= 0x80 && n <= 0x8F) n = n + 0x70;
          break;
        }
      }
    }
    if (n == 0) break;

    m[0] = n; strcat(target, m);
    j++; if (j >= maxString) break;
  }
  return target;
}

loop ()

{

  tft.setTextSize(1);
tft.setCursor(0, 20);
tft.setFreeFont(&GlametrixLight12pt7b);
tft.println(utf8rus_P("Привет"));

}
but it's not any on display... Please help, how show cyrillic symbol? Thanks!