@@ -1392,7 +1392,7 @@ void Adafruit_GFX::charBounds(char c, int16_t *x, int16_t *y,
13921392 @param h The boundary height, set by function
13931393*/
13941394/* *************************************************************************/
1395- void Adafruit_GFX::getTextBounds (char *str, int16_t x, int16_t y,
1395+ void Adafruit_GFX::getTextBounds (const char *str, int16_t x, int16_t y,
13961396 int16_t *x1, int16_t *y1, uint16_t *w, uint16_t *h) {
13971397 uint8_t c; // Current character
13981398
@@ -1415,6 +1415,15 @@ void Adafruit_GFX::getTextBounds(char *str, int16_t x, int16_t y,
14151415 }
14161416}
14171417
1418+ // Overload for the same as above, but for String strings
1419+ void Adafruit_GFX::getTextBounds (const String &str, int16_t x, int16_t y,
1420+ int16_t *x1, int16_t *y1, uint16_t *w, uint16_t *h) {
1421+ if (str.length () != 0 ) {
1422+ getTextBounds (const_cast <char *>(str.c_str ()), x, y, x1, y1, w, h);
1423+ }
1424+ }
1425+
1426+
14181427/* *************************************************************************/
14191428/* !
14201429 @brief Helper to determine size of a PROGMEM string with current font/size. Pass string and a cursor position, returns UL corner and W,H.
0 commit comments