Add FLASH based anti-aliased fonts

Processors (such as STM32) that are not supported by a SPIFFS library can now use anti-aliased (smooth) fonts stored in FLASH (program) memory.
This commit is contained in:
Bodmer
2020-02-14 23:54:37 +00:00
parent d2270c3611
commit c689b4211d
74 changed files with 12610 additions and 61 deletions
+10 -1
View File
@@ -2359,19 +2359,28 @@ void TFT_eSprite::drawGlyph(uint16_t code)
this->cursor_y = 0;
}
#if defined (ESP32) || defined (ESP8266)
this->fontFile.seek(this->gBitmap[gNum], fs::SeekSet); // This is slow for a significant position shift!
uint8_t pbuffer[this->gWidth[gNum]];
#else
const uint8_t* gPtr = (const uint8_t*) this->gFont.gArray;
#endif
int16_t xs = 0;
uint16_t dl = 0;
for (int32_t y = 0; y < this->gHeight[gNum]; y++)
{
#if defined (ESP32) || defined (ESP8266)
this->fontFile.read(pbuffer, this->gWidth[gNum]);
#endif
for (int32_t x = 0; x < this->gWidth[gNum]; x++)
{
#if defined (ESP32) || defined (ESP8266)
uint8_t pixel = pbuffer[x];
#else
uint8_t pixel = gPtr[gBitmap[gNum] + x + gWidth[gNum] * y];
#endif
if (pixel)
{
if (pixel != 0xFF)