Fix autobahn font being active

This commit is contained in:
CommanderRedYT
2022-10-26 16:54:30 +02:00
parent 4dacb617be
commit 3719f89a0e
2 changed files with 9 additions and 0 deletions

View File

@@ -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"

View File

@@ -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;
}