diff options
author | Tomi Korpipaa <tomi.korpipaa@qt.io> | 2020-11-06 09:18:45 +0200 |
---|---|---|
committer | Tomi Korpipaa <tomi.korpipaa@qt.io> | 2020-11-19 08:05:30 +0200 |
commit | 4d6ea9416ab8006a91544f05f86e5174617be683 (patch) | |
tree | e1a2035167be0b344b66dce43ebec28ade4664ad | |
parent | 0ac26f8f9726281f7bff01f3c07a9c6b99d9e9d5 (diff) |
Convert <br> to line break on runtime
Task-number: QT3DS-4202
Change-Id: Ia3ddaaec3938155216119917640244f96115452d
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
-rw-r--r-- | src/runtimerender/Qt3DSDistanceFieldRenderer.cpp | 1 | ||||
-rw-r--r-- | src/runtimerender/Qt3DSQtTextRenderer.cpp | 7 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/runtimerender/Qt3DSDistanceFieldRenderer.cpp b/src/runtimerender/Qt3DSDistanceFieldRenderer.cpp index 12c46c3..3986319 100644 --- a/src/runtimerender/Qt3DSDistanceFieldRenderer.cpp +++ b/src/runtimerender/Qt3DSDistanceFieldRenderer.cpp @@ -182,6 +182,7 @@ Q3DSDistanceFieldRenderer::buildGlyphsPerTexture(const SText &textInfo) QString text = textInfo.m_Text.c_str(); text.replace(QLatin1Char('\n'), QChar::LineSeparator); + text.replace(QLatin1String("<br>"), QString(QChar::LineSeparator)); qreal width; qreal height; diff --git a/src/runtimerender/Qt3DSQtTextRenderer.cpp b/src/runtimerender/Qt3DSQtTextRenderer.cpp index 8587c8b..5dea413 100644 --- a/src/runtimerender/Qt3DSQtTextRenderer.cpp +++ b/src/runtimerender/Qt3DSQtTextRenderer.cpp @@ -423,6 +423,13 @@ struct Qt3DSQtTextRenderer : public ITextRenderer ++lines; lineList.append(QString::fromUtf8(lineStartItem, lineLen - chopAmount)); lineLen = 0; + } else if (lineLen > 3 && *item == '>' && *(item - 1) == 'r' && *(item - 2) == 'b' + && *(item - 3) == '<') { + int chopAmount = 4; + + ++lines; + lineList.append(QString::fromUtf8(lineStartItem, lineLen - chopAmount)); + lineLen = 0; } } if (lineStartItem) |