Fix for Chinese fonts

This commit is contained in:
Sjef Verhoeven PE5PVB
2023-08-04 10:35:18 +02:00
parent fc14a4bc0f
commit 277592e16d

View File

@@ -4768,8 +4768,11 @@ void DefaultSettings(byte userhardwaremodel) {
void tftPrint(int8_t offset, const String & text, int16_t x, int16_t y, int color, int smoothcolor, const uint8_t* font) {
if (language == LANGUAGE_CHS) {
if (font == FONT16) font = FONT16_CHS;
else if (font == FONT28) font = FONT28_CHS;
if (memcmp(font, FONT16, sizeof(FONT16)) == 0) {
font = FONT16_CHS;
} else if (memcmp(font, FONT28, sizeof(FONT28)) == 0) {
font = FONT28_CHS;
}
}
if (currentFont != font || resetFontOnNextCall) {
@@ -4792,13 +4795,15 @@ void tftPrint(int8_t offset, const String & text, int16_t x, int16_t y, int colo
void tftReplace(int8_t offset, const String & textold, const String & text, int16_t x, int16_t y, int color, int smoothcolor, const uint8_t* font) {
if (language == LANGUAGE_CHS) {
if (font == FONT16) font = FONT16_CHS;
if (font == FONT28) font = FONT28_CHS;
if (memcmp(font, FONT16, sizeof(FONT16)) == 0) {
font = FONT16_CHS;
} else if (memcmp(font, FONT28, sizeof(FONT28)) == 0) {
font = FONT28_CHS;
}
}
if (currentFont != font || resetFontOnNextCall) {
if (currentFont != nullptr) tft.unloadFont();
tft.loadFont(font);
currentFont = font;
resetFontOnNextCall = false;