You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The situation is this; Screen A goes to Screen B which has buttons created with TFT_eSPI_Button , then returns to Screen A. After returning to Screen A all the text is wrong size. (2x) Screen A does not use buttons, only Screen B.
This was caused by code in Button.cpp, drawButton() function, line 70 ( _gfx->setTextSize(_textsize); ), that sets the font size multiplier to the value passed in the initialization. In my case 2 for two times base size. That setting is outside of TFT_eSPI_Button and remains set after the button code has finished. Thus the code that comes later still has the font size multiplier set and displays incorrectly.
This was very time consuming to debug but once understood the solution was as simple as calling tft.setTextSize(1) after returning from Screen B, to reset the font size multiplier to unity.
I suggest the code in Button.cpp be modified to reset the font size multiplier to whatever it was upon entry to the drawButton() function. Having global settings like this changed without your knowledge is not unexpected behavior and leads to difficult debugging sessions.
Otherwise, kind regards and thanks for all the good work making this library.
Gene
Version 2.4.80
The text was updated successfully, but these errors were encountered:
The situation is this; Screen A goes to Screen B which has buttons created with TFT_eSPI_Button , then returns to Screen A. After returning to Screen A all the text is wrong size. (2x) Screen A does not use buttons, only Screen B.
This was caused by code in Button.cpp, drawButton() function, line 70 (
_gfx->setTextSize(_textsize);
), that sets the font size multiplier to the value passed in the initialization. In my case 2 for two times base size. That setting is outside of TFT_eSPI_Button and remains set after the button code has finished. Thus the code that comes later still has the font size multiplier set and displays incorrectly.This was very time consuming to debug but once understood the solution was as simple as calling
tft.setTextSize(1)
after returning from Screen B, to reset the font size multiplier to unity.I suggest the code in Button.cpp be modified to reset the font size multiplier to whatever it was upon entry to the drawButton() function. Having global settings like this changed without your knowledge is not unexpected behavior and leads to difficult debugging sessions.
Otherwise, kind regards and thanks for all the good work making this library.
Gene
Version 2.4.80
The text was updated successfully, but these errors were encountered: