mirror of
https://github.com/Bodmer/TFT_eSPI.git
synced 2025-08-02 12:14:40 +02:00
Allow partially of screen RLE fonts
This commit is contained in:
60
TFT_eSPI.cpp
60
TFT_eSPI.cpp
@@ -3578,21 +3578,55 @@ int16_t TFT_eSPI::drawChar(uint16_t uniCode, int32_t x, int32_t y, uint8_t font)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else { // Text colour != background && textsize = 1
|
else {
|
||||||
// so use faster drawing of characters and background using block write
|
// Text colour != background && textsize = 1 and character is within screen area
|
||||||
setWindow(x, y, x + width - 1, y + height - 1);
|
// so use faster drawing of characters and background using block write
|
||||||
|
if ((x >= 0) && (x + width <= _width) && (y >= 0) && (y + height <= _height))
|
||||||
|
{
|
||||||
|
setWindow(x, y, x + width - 1, y + height - 1);
|
||||||
|
|
||||||
// Maximum font size is equivalent to 180x180 pixels in area
|
// Maximum font size is equivalent to 180x180 pixels in area
|
||||||
while (w > 0) {
|
while (w > 0) {
|
||||||
line = pgm_read_byte((uint8_t *)flash_address++); // 8 bytes smaller when incrementing here
|
line = pgm_read_byte((uint8_t *)flash_address++); // 8 bytes smaller when incrementing here
|
||||||
if (line & 0x80) {
|
if (line & 0x80) {
|
||||||
line &= 0x7F;
|
line &= 0x7F;
|
||||||
line++; w -= line;
|
line++; w -= line;
|
||||||
pushBlock(textcolor,line);
|
pushBlock(textcolor,line);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
line++; w -= line;
|
||||||
|
pushBlock(textbgcolor,line);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
}
|
||||||
line++; w -= line;
|
else
|
||||||
pushBlock(textbgcolor,line);
|
{
|
||||||
|
int32_t px = x, py = y; // To hold character block start and end column and row values
|
||||||
|
int32_t pc = 0; // Pixel count
|
||||||
|
int32_t pl = 0; // Pixel line length
|
||||||
|
uint16_t pcol = 0; // Pixel color
|
||||||
|
|
||||||
|
while (pc < w) {
|
||||||
|
line = pgm_read_byte((uint8_t *)flash_address);
|
||||||
|
flash_address++;
|
||||||
|
if (line & 0x80) { pcol = textcolor; line &= 0x7F; }
|
||||||
|
else pcol = textbgcolor;
|
||||||
|
line++;
|
||||||
|
px = x + pc % width;
|
||||||
|
py = y + pc / width;
|
||||||
|
|
||||||
|
pl = 0;
|
||||||
|
pc += line;
|
||||||
|
while (line--) { // In this case the while(line--) is faster
|
||||||
|
pl++;
|
||||||
|
if ((px+pl) >= (x + width)) {
|
||||||
|
drawFastHLine(px, py, pl, pcol);
|
||||||
|
pl = 0;
|
||||||
|
px = x;
|
||||||
|
py ++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (pl)drawFastHLine(px, py, pl, pcol);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
#ifndef _TFT_eSPIH_
|
#ifndef _TFT_eSPIH_
|
||||||
#define _TFT_eSPIH_
|
#define _TFT_eSPIH_
|
||||||
|
|
||||||
#define TFT_ESPI_VERSION "2.2.10"
|
#define TFT_ESPI_VERSION "2.2.11"
|
||||||
|
|
||||||
/***************************************************************************************
|
/***************************************************************************************
|
||||||
** Section 1: Load required header files
|
** Section 1: Load required header files
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "TFT_eSPI",
|
"name": "TFT_eSPI",
|
||||||
"version": "2.2.10",
|
"version": "2.2.11",
|
||||||
"keywords": "Arduino, tft, ePaper, display, STM32, ESP8266, NodeMCU, ESP32, M5Stack, ILI9341, ST7735, ILI9163, S6D02A1, ILI9486, ST7789, RM68140",
|
"keywords": "Arduino, tft, ePaper, display, STM32, ESP8266, NodeMCU, ESP32, M5Stack, ILI9341, ST7735, ILI9163, S6D02A1, ILI9486, ST7789, RM68140",
|
||||||
"description": "A TFT and ePaper SPI graphics library with optimisation for ESP8266, ESP32 and STM32",
|
"description": "A TFT and ePaper SPI graphics library with optimisation for ESP8266, ESP32 and STM32",
|
||||||
"repository":
|
"repository":
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
name=TFT_eSPI
|
name=TFT_eSPI
|
||||||
version=2.2.10
|
version=2.2.11
|
||||||
author=Bodmer
|
author=Bodmer
|
||||||
maintainer=Bodmer
|
maintainer=Bodmer
|
||||||
sentence=TFT graphics library for Arduino processors with performance optimisation for STM32, ESP8266 and ESP32
|
sentence=TFT graphics library for Arduino processors with performance optimisation for STM32, ESP8266 and ESP32
|
||||||
|
Reference in New Issue
Block a user