From 4d181d7a194e07d81cc6b8b95dea6ee57d019892 Mon Sep 17 00:00:00 2001 From: Bodmer Date: Thu, 12 Apr 2018 18:48:01 +0100 Subject: [PATCH] Fix bug #122 by different approach --- TFT_eSPI.cpp | 4 ++-- TFT_eSPI.h | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/TFT_eSPI.cpp b/TFT_eSPI.cpp index bf415e4..b1a5a6b 100644 --- a/TFT_eSPI.cpp +++ b/TFT_eSPI.cpp @@ -4115,9 +4115,9 @@ int16_t TFT_eSPI::drawString(const char *string, int poX, int poY, int font) } // Check coordinates are OK, adjust if not if (poX < 0) poX = 0; - if (poX+cwidth>_width) poX = _width - cwidth; + if (poX+cwidth > width()) poX = width() - cwidth; if (poY < 0) poY = 0; - if (poY+cheight-baseline>_height) poY = _height - cheight; + if (poY+cheight-baseline> height()) poY = height() - cheight; } diff --git a/TFT_eSPI.h b/TFT_eSPI.h index 7fc242a..e4d98e5 100644 --- a/TFT_eSPI.h +++ b/TFT_eSPI.h @@ -471,7 +471,9 @@ class TFT_eSPI : public Print { fillRect(int32_t x, int32_t y, int32_t w, int32_t h, uint32_t color); virtual int16_t drawChar(unsigned int uniCode, int x, int y, int font), - drawChar(unsigned int uniCode, int x, int y); + drawChar(unsigned int uniCode, int x, int y), + height(void), + width(void); // The TFT_eSprite class inherits the following functions void setWindow(int16_t x0, int16_t y0, int16_t x1, int16_t y1), @@ -588,9 +590,7 @@ class TFT_eSPI : public Print { drawCentreString(const String& string, int dX, int poY, int font), // Deprecated, use setTextDatum() and drawString() drawRightString(const String& string, int dX, int poY, int font); // Deprecated, use setTextDatum() and drawString() - int16_t height(void), - width(void), - textWidth(const char *string, int font), + int16_t textWidth(const char *string, int font), textWidth(const char *string), textWidth(const String& string, int font), textWidth(const String& string),