提交 869ec4a9 编写于 作者: O openharmony_ci 提交者: Gitee

!53 Rectify the newline error caused by the newline character in the character string

Merge pull request !53 from wangtiantian/MyMaster
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册