From f4d375b12e71e2e7cd13d4a678d2f2150cf01723 Mon Sep 17 00:00:00 2001 From: CommanderRedYT Date: Fri, 16 Dec 2022 14:29:13 +0100 Subject: [PATCH 1/2] Theoretical fix for autobahn font not rendering correctly --- TFT_eSPI.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TFT_eSPI.cpp b/TFT_eSPI.cpp index 67f916f..60a4730 100644 --- a/TFT_eSPI.cpp +++ b/TFT_eSPI.cpp @@ -2261,7 +2261,7 @@ int16_t TFT_eSPI::height() const int16_t TFT_eSPI::textWidth(std::string_view string, uint8_t font) { - int32_t str_width = 0; + int32_t str_width = 1; uint16_t uniCode = 0; auto iter = std::begin(string); From 576299b9d91443652d4c7eeb8d785cc65dde49bf Mon Sep 17 00:00:00 2001 From: CommanderRedYT Date: Fri, 16 Dec 2022 14:39:24 +0100 Subject: [PATCH 2/2] Only apply fix when the right font is selected --- TFT_eSPI.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/TFT_eSPI.cpp b/TFT_eSPI.cpp index 60a4730..b1e586f 100644 --- a/TFT_eSPI.cpp +++ b/TFT_eSPI.cpp @@ -2261,9 +2261,16 @@ int16_t TFT_eSPI::height() const int16_t TFT_eSPI::textWidth(std::string_view string, uint8_t font) { - int32_t str_width = 1; + int32_t str_width = 0; uint16_t uniCode = 0; +#ifdef CONFIG_TFT_IS_AUTOBAHN + if (font == 1 || (gfxFont != &din1451alt10pt8b && font == 4)) + { + str_width = 1; + } +#endif + auto iter = std::begin(string); #ifdef SMOOTH_FONT