Merge pull request #1 from 0xFEEDC0DE64/autobahn

This commit is contained in:
CommanderRedYT
2022-10-26 17:20:05 +02:00
committed by GitHub
2 changed files with 11 additions and 0 deletions

View File

@@ -351,6 +351,11 @@ menu "TFT_eSPI"
config TFT_SMOOTH_FONT config TFT_SMOOTH_FONT
bool "Smooth Fonts" bool "Smooth Fonts"
default "y" default "y"
config TFT_IS_AUTOBAHN
bool "TFT Use Autobahn font"
default "y"
endmenu endmenu
menu "Touch screen configuration" menu "Touch screen configuration"

View File

@@ -46,7 +46,9 @@
#include "esp32-hal-gpio.h" #include "esp32-hal-gpio.h"
#include "esp32-hal-misc.h" #include "esp32-hal-misc.h"
#ifdef CONFIG_TFT_IS_AUTOBAHN
#include "din1451alt10pt8b.cpp" #include "din1451alt10pt8b.cpp"
#endif
namespace { namespace {
void delay(uint32_t ms) void delay(uint32_t ms)
@@ -4909,8 +4911,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 // 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) 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) if (font == 4)
font = 1; font = 1;
#endif
int16_t sumX = 0; int16_t sumX = 0;
uint8_t padding = 1, baseline = 0; uint8_t padding = 1, baseline = 0;
uint16_t cwidth = textWidth(string, font); // Find the pixel width of the string in the font uint16_t cwidth = textWidth(string, font); // Find the pixel width of the string in the font
@@ -5196,10 +5200,12 @@ void TFT_eSPI::setFreeFont(const GFXfont *f)
***************************************************************************************/ ***************************************************************************************/
void TFT_eSPI::setTextFont(uint8_t f) void TFT_eSPI::setTextFont(uint8_t f)
{ {
#ifdef TFT_IS_AUTOBAHN
if (f == 4) { if (f == 4) {
setFreeFont(&din1451alt10pt8b); setFreeFont(&din1451alt10pt8b);
return; return;
} }
#endif
textfont = (f > 0) ? f : 1; // Don't allow font 0 textfont = (f > 0) ? f : 1; // Don't allow font 0
gfxFont = NULL; gfxFont = NULL;
} }