diff --git a/frameworks/common/typed_text.cpp b/frameworks/common/typed_text.cpp index 0f5f01c817a2ab8ada3836f72e6282e1eae85576..bc9d48ecde104e4c61a36bab8c364431eb12a2d3 100755 --- a/frameworks/common/typed_text.cpp +++ b/frameworks/common/typed_text.cpp @@ -144,7 +144,8 @@ void TypedText::GetArcLetterPos(const Point& arcCenter, uint16_t radius, float a uint32_t TypedText::GetNextLine(const char* text, int16_t letterSpace, int16_t maxWidth) { uint32_t index = 0; - if ((text == nullptr) || GetWrapPoint(text, index)) { + if ((text == nullptr) || (GetWrapPoint(text, index) && + (TypedText::GetTextWidth(text, index, letterSpace) <= maxWidth))) { return index; } uint32_t lastBreakPos = 0; @@ -183,7 +184,7 @@ uint32_t TypedText::GetNextLine(const char* text, int16_t letterSpace, int16_t m if (text[index] == '\0') { break; } - if (GetWrapPoint(text + index, tmp)) { + if (GetWrapPoint(text + index, tmp) && (TypedText::GetTextWidth(text, index + tmp, letterSpace) <= maxWidth)) { return index + tmp; } index += tmp;