Add option to correct legacy Adafruit GLCD font bug

Raise issue
This commit is contained in:
Bodmer 2023-12-05 17:22:22 +00:00
parent a79d6f14e2
commit 6e644c3e63
6 changed files with 16 additions and 11 deletions

View File

@ -2001,6 +2001,9 @@ void TFT_eSprite::drawChar(int32_t x, int32_t y, uint16_t c, uint32_t color, uin
((y + 8 * size - 1) < (_vpY - _yDatum))) // Clip top
return;
if (c > 255) return;
if (!_cp437 && c > 175) c++;
bool fillbg = (bg != color);
if ((size==1) && fillbg)

View File

@ -182,8 +182,9 @@ static const unsigned char font[] PROGMEM = {
0x00, 0x00, 0x7B, 0x00, 0x00,
0x08, 0x14, 0x2A, 0x14, 0x22,
0x22, 0x14, 0x2A, 0x14, 0x08,
0xAA, 0x00, 0x55, 0x00, 0xAA,
0xAA, 0x55, 0xAA, 0x55, 0xAA,
0x55, 0x00, 0x55, 0x00, 0x55, // #176 (25% block) missing in old code
0xAA, 0x55, 0xAA, 0x55, 0xAA, // 50% block
0xFF, 0x55, 0xFF, 0x55, 0xFF, // 75% block
0x00, 0x00, 0x00, 0xFF, 0x00,
0x10, 0x10, 0x10, 0xFF, 0x00,
0x14, 0x14, 0x14, 0xFF, 0x00,

View File

@ -467,7 +467,7 @@ TFT_eSPI::TFT_eSPI(int16_t w, int16_t h)
lockTransaction = false; // start/endWrite lock flag to allow sketch to keep SPI bus access open
_booted = true; // Default attributes
_cp437 = true; // Legacy GLCD font bug fix
_cp437 = false; // Legacy GLCD font bug fix disabled by default
_utf8 = true; // UTF8 decoding enabled
#if defined (FONT_FS_AVAILABLE) && defined (SMOOTH_FONT)
@ -2158,7 +2158,7 @@ void TFT_eSPI::pushMaskedImage(int32_t x, int32_t y, int32_t w, int32_t h, uint1
xp += clearCount;
clearCount = 0;
pushImage(x + xp, y, setCount, 1, iptr + xp); // pushImage handles clipping
if (mptr >= eptr) break;
if (mptr >= eptr) break;
xp += setCount;
}
} while (setCount || mptr < eptr);
@ -2866,7 +2866,7 @@ void TFT_eSPI::setCursor(int16_t x, int16_t y)
***************************************************************************************/
void TFT_eSPI::setCursor(int16_t x, int16_t y, uint8_t font)
{
textfont = font;
setTextFont(font);
cursor_x = x;
cursor_y = y;
}
@ -3188,8 +3188,6 @@ void TFT_eSPI::drawChar(int32_t x, int32_t y, uint16_t c, uint32_t color, uint32
#endif
//>>>>>>>>>>>>>>>>>>
if (c > 255) return;
int32_t xd = x + _xDatum;
int32_t yd = y + _yDatum;
@ -3199,6 +3197,9 @@ void TFT_eSPI::drawChar(int32_t x, int32_t y, uint16_t c, uint32_t color, uint32
((yd + 8 * size - 1) < _vpY)) // Clip top
return;
if (c > 255) return;
if (!_cp437 && c > 175) c++;
bool fillbg = (bg != color);
bool clip = xd < _vpX || xd + 6 * textsize >= _vpW || yd < _vpY || yd + 8 * textsize >= _vpH;

View File

@ -16,7 +16,7 @@
#ifndef _TFT_eSPIH_
#define _TFT_eSPIH_
#define TFT_ESPI_VERSION "2.5.34"
#define TFT_ESPI_VERSION "2.5.40"
// Bit level feature flags
// Bit 0 set: viewport capability
@ -939,7 +939,7 @@ class TFT_eSPI : public Print { friend class TFT_eSprite; // Sprite class has ac
bool _booted; // init() or begin() has already run once
// User sketch manages these via set/getAttribute()
bool _cp437; // If set, use correct CP437 charset (default is ON)
bool _cp437; // If set, use correct CP437 charset (default is OFF)
bool _utf8; // If set, use UTF-8 decoder in print stream 'write()' function (default ON)
bool _psram_enable; // Enable PSRAM use for library functions (TBD) and Sprites

View File

@ -1,6 +1,6 @@
{
"name": "TFT_eSPI",
"version": "2.5.34",
"version": "2.5.40",
"keywords": "Arduino, tft, display, ttgo, LilyPi, WT32-SC01, ePaper, display, Pico, RP2040 Nano Connect, RP2040, STM32, ESP8266, NodeMCU, ESP32, M5Stack, ILI9341, ST7735, ILI9163, S6D02A1, ILI9481, ILI9486, ILI9488, ST7789, ST7796, RM68140, SSD1351, SSD1963, ILI9225, HX8357D, GC9A01, R61581",
"description": "A TFT and ePaper (SPI or parallel interface) graphics library with optimisation for Raspberry Pi Pico, RP2040, ESP8266, ESP32 and STM32 processors",
"repository":

View File

@ -1,5 +1,5 @@
name=TFT_eSPI
version=2.5.34
version=2.5.40
author=Bodmer
maintainer=Bodmer
sentence=TFT graphics library for Arduino processors with performance optimisation for RP2040, STM32, ESP8266 and ESP32