From d405df0a64649a66269728ea1a8ef6c49c9ce4fc Mon Sep 17 00:00:00 2001 From: doctea Date: Tue, 25 Jun 2024 22:44:45 +0100 Subject: [PATCH 1/2] expose current TextWrap settings via getTextWrapX() and getTextWrapY() --- TFT_eSPI.cpp | 17 +++++++++++++++++ TFT_eSPI.h | 3 +++ 2 files changed, 20 insertions(+) diff --git a/TFT_eSPI.cpp b/TFT_eSPI.cpp index d537faeb..e4e45baa 100644 --- a/TFT_eSPI.cpp +++ b/TFT_eSPI.cpp @@ -2983,6 +2983,23 @@ void TFT_eSPI::setTextWrap(bool wrapX, bool wrapY) textwrapY = wrapY; } +/*************************************************************************************** +** Function name: getTextWrapX +** Description: Returns current text wrap width setting +***************************************************************************************/ +bool TFT_eSPI::getTextWrapX() { + return textwrapX; +} + + +/*************************************************************************************** +** Function name: getTextWrapY +** Description: Returns current text wrap height setting +***************************************************************************************/ +bool TFT_eSPI::getTextWrapY() { + return textwrapY; +} + /*************************************************************************************** ** Function name: setTextDatum diff --git a/TFT_eSPI.h b/TFT_eSPI.h index 8ae23427..30e0cb8d 100644 --- a/TFT_eSPI.h +++ b/TFT_eSPI.h @@ -662,6 +662,9 @@ class TFT_eSPI : public Print { friend class TFT_eSprite; // Sprite class has ac setTextSize(uint8_t size); // Set character size multiplier (this increases pixel size) void setTextWrap(bool wrapX, bool wrapY = false); // Turn on/off wrapping of text in TFT width and/or height + bool getTextWrapX(); // get current textwrap setting for width + bool getTextWrapY(); // get current textwrap setting for height + void setTextDatum(uint8_t datum); // Set text datum position (default is top left), see Section 5 above uint8_t getTextDatum(void); From db2eb4a164de201309591c82fc4bb4e6c90631be Mon Sep 17 00:00:00 2001 From: doctea Date: Tue, 25 Jun 2024 22:47:39 +0100 Subject: [PATCH 2/2] add a getTextWrap() that is an alias for getTextWrapX(), so that API more closely matches some other graphics libraries --- TFT_eSPI.cpp | 3 +++ TFT_eSPI.h | 1 + 2 files changed, 4 insertions(+) diff --git a/TFT_eSPI.cpp b/TFT_eSPI.cpp index e4e45baa..f1487b12 100644 --- a/TFT_eSPI.cpp +++ b/TFT_eSPI.cpp @@ -2990,6 +2990,9 @@ void TFT_eSPI::setTextWrap(bool wrapX, bool wrapY) bool TFT_eSPI::getTextWrapX() { return textwrapX; } +bool TFT_eSPI::getTextWrap() { + return textwrapX; +} /*************************************************************************************** diff --git a/TFT_eSPI.h b/TFT_eSPI.h index 30e0cb8d..f97f4b9d 100644 --- a/TFT_eSPI.h +++ b/TFT_eSPI.h @@ -663,6 +663,7 @@ class TFT_eSPI : public Print { friend class TFT_eSprite; // Sprite class has ac void setTextWrap(bool wrapX, bool wrapY = false); // Turn on/off wrapping of text in TFT width and/or height bool getTextWrapX(); // get current textwrap setting for width + bool getTextWrap(); // get current textwrap setting for width (to match some other graphics libraries) bool getTextWrapY(); // get current textwrap setting for height