Support external font classes in button class
Original Adafruit button rendering code can be used with an external font class if "textFont" is set to 255. See #1536
This commit is contained in:
parent
bb2424f168
commit
73ff86b85b
|
|
@ -64,6 +64,14 @@ void TFT_eSPI_Button::drawButton(bool inverted, String long_name) {
|
||||||
_gfx->fillRoundRect(_x1, _y1, _w, _h, r, fill);
|
_gfx->fillRoundRect(_x1, _y1, _w, _h, r, fill);
|
||||||
_gfx->drawRoundRect(_x1, _y1, _w, _h, r, outline);
|
_gfx->drawRoundRect(_x1, _y1, _w, _h, r, outline);
|
||||||
|
|
||||||
|
if (_gfx->textfont == 255) {
|
||||||
|
_gfx->setCursor(_x1 + (_w / 2) - (strlen(_label) * 3 * _textsize),
|
||||||
|
_y1 + (_h / 2) - (4 * _textsize));
|
||||||
|
_gfx->setTextColor(text);
|
||||||
|
_gfx->setTextSize(_textsize);
|
||||||
|
_gfx->print(_label);
|
||||||
|
}
|
||||||
|
else {
|
||||||
_gfx->setTextColor(text, fill);
|
_gfx->setTextColor(text, fill);
|
||||||
_gfx->setTextSize(_textsize);
|
_gfx->setTextSize(_textsize);
|
||||||
|
|
||||||
|
|
@ -79,6 +87,7 @@ void TFT_eSPI_Button::drawButton(bool inverted, String long_name) {
|
||||||
|
|
||||||
_gfx->setTextDatum(tempdatum);
|
_gfx->setTextDatum(tempdatum);
|
||||||
_gfx->setTextPadding(tempPadding);
|
_gfx->setTextPadding(tempPadding);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TFT_eSPI_Button::contains(int16_t x, int16_t y) {
|
bool TFT_eSPI_Button::contains(int16_t x, int16_t y) {
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
#ifndef _TFT_eSPIH_
|
#ifndef _TFT_eSPIH_
|
||||||
#define _TFT_eSPIH_
|
#define _TFT_eSPIH_
|
||||||
|
|
||||||
#define TFT_ESPI_VERSION "2.4.23"
|
#define TFT_ESPI_VERSION "2.4.24"
|
||||||
|
|
||||||
// Bit level feature flags
|
// Bit level feature flags
|
||||||
// Bit 0 set: viewport capability
|
// Bit 0 set: viewport capability
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "TFT_eSPI",
|
"name": "TFT_eSPI",
|
||||||
"version": "2.4.23",
|
"version": "2.4.24",
|
||||||
"keywords": "Arduino, tft, ePaper, display, Pico, RP2040, STM32, ESP8266, NodeMCU, ESP32, M5Stack, ILI9341, ST7735, ILI9163, S6D02A1, ILI9481, ILI9486, ILI9488, ST7789, RM68140, SSD1351, SSD1963, ILI9225, HX8357D",
|
"keywords": "Arduino, tft, ePaper, display, Pico, RP2040, STM32, ESP8266, NodeMCU, ESP32, M5Stack, ILI9341, ST7735, ILI9163, S6D02A1, ILI9481, ILI9486, ILI9488, ST7789, RM68140, SSD1351, SSD1963, ILI9225, HX8357D",
|
||||||
"description": "A TFT and ePaper SPI graphics library with optimisation for Raspberry Pi Pico, ESP8266, ESP32 and STM32",
|
"description": "A TFT and ePaper SPI graphics library with optimisation for Raspberry Pi Pico, ESP8266, ESP32 and STM32",
|
||||||
"repository":
|
"repository":
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
name=TFT_eSPI
|
name=TFT_eSPI
|
||||||
version=2.4.23
|
version=2.4.24
|
||||||
author=Bodmer
|
author=Bodmer
|
||||||
maintainer=Bodmer
|
maintainer=Bodmer
|
||||||
sentence=TFT graphics library for Arduino processors with performance optimisation for RP2040, STM32, ESP8266 and ESP32
|
sentence=TFT graphics library for Arduino processors with performance optimisation for RP2040, STM32, ESP8266 and ESP32
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue