From 3719f89a0e70f0d919aab99bbbe28a37c7dd934d Mon Sep 17 00:00:00 2001 From: CommanderRedYT Date: Wed, 26 Oct 2022 16:54:30 +0200 Subject: [PATCH 1/2] Fix autobahn font being active --- Kconfig | 5 +++++ TFT_eSPI.cpp | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/Kconfig b/Kconfig index b4efe20..7bc01a1 100644 --- a/Kconfig +++ b/Kconfig @@ -351,6 +351,11 @@ menu "TFT_eSPI" config TFT_SMOOTH_FONT bool "Smooth Fonts" default "y" + + config TFT_IS_AUTOBAHN + bool "TFT Use Autobahn font" + default "y" + endmenu menu "Touch screen configuration" diff --git a/TFT_eSPI.cpp b/TFT_eSPI.cpp index e42df8f..d92e009 100644 --- a/TFT_eSPI.cpp +++ b/TFT_eSPI.cpp @@ -4909,8 +4909,10 @@ int16_t TFT_eSPI::drawString(std::string_view string, int32_t poX, int32_t poY) // With font number. Note: font number is over-ridden if a smooth font is loaded int16_t TFT_eSPI::drawString(std::string_view string, int32_t poX, int32_t poY, uint8_t font) { +#ifdef CONFIG_TFT_IS_AUTOBAHN if (font == 4) font = 1; +#endif int16_t sumX = 0; uint8_t padding = 1, baseline = 0; uint16_t cwidth = textWidth(string, font); // Find the pixel width of the string in the font @@ -5196,10 +5198,12 @@ void TFT_eSPI::setFreeFont(const GFXfont *f) ***************************************************************************************/ void TFT_eSPI::setTextFont(uint8_t f) { +#ifdef TFT_IS_AUTOBAHN if (f == 4) { setFreeFont(&din1451alt10pt8b); return; } +#endif textfont = (f > 0) ? f : 1; // Don't allow font 0 gfxFont = NULL; } From 91bc2eb1b1d2f888dd1f83c52ab5b654526993ff Mon Sep 17 00:00:00 2001 From: CommanderRedYT Date: Wed, 26 Oct 2022 17:18:26 +0200 Subject: [PATCH 2/2] Fixed include --- TFT_eSPI.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/TFT_eSPI.cpp b/TFT_eSPI.cpp index d92e009..49ff89e 100644 --- a/TFT_eSPI.cpp +++ b/TFT_eSPI.cpp @@ -46,7 +46,9 @@ #include "esp32-hal-gpio.h" #include "esp32-hal-misc.h" +#ifdef CONFIG_TFT_IS_AUTOBAHN #include "din1451alt10pt8b.cpp" +#endif namespace { void delay(uint32_t ms)