Fix for Chinese fonts
This commit is contained in:
+10
-5
@@ -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) {
|
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 (language == LANGUAGE_CHS) {
|
||||||
if (font == FONT16) font = FONT16_CHS;
|
if (memcmp(font, FONT16, sizeof(FONT16)) == 0) {
|
||||||
else if (font == FONT28) font = FONT28_CHS;
|
font = FONT16_CHS;
|
||||||
|
} else if (memcmp(font, FONT28, sizeof(FONT28)) == 0) {
|
||||||
|
font = FONT28_CHS;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentFont != font || resetFontOnNextCall) {
|
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) {
|
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 (language == LANGUAGE_CHS) {
|
||||||
if (font == FONT16) font = FONT16_CHS;
|
if (memcmp(font, FONT16, sizeof(FONT16)) == 0) {
|
||||||
if (font == FONT28) font = FONT28_CHS;
|
font = FONT16_CHS;
|
||||||
|
} else if (memcmp(font, FONT28, sizeof(FONT28)) == 0) {
|
||||||
|
font = FONT28_CHS;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentFont != font || resetFontOnNextCall) {
|
if (currentFont != font || resetFontOnNextCall) {
|
||||||
if (currentFont != nullptr) tft.unloadFont();
|
if (currentFont != nullptr) tft.unloadFont();
|
||||||
|
|
||||||
tft.loadFont(font);
|
tft.loadFont(font);
|
||||||
currentFont = font;
|
currentFont = font;
|
||||||
resetFontOnNextCall = false;
|
resetFontOnNextCall = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user