summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gui/text/qtextlayout.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index 84ad9038d5..ede7426ffc 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -1842,8 +1842,17 @@ void QTextLine::layout_helper(int maxGlyphs)
addNextCluster(lbh.currentPosition, end, lbh.tmpData, lbh.glyphCount,
current, lbh.logClusters, lbh.glyphs);
+ // This is a hack to fix a regression caused by the introduction of the
+ // whitespace flag to non-breakable spaces and will cause the non-breakable
+ // spaces to behave as in previous Qt versions in the line breaking algorithm.
+ // The line breaks do not currently follow the Unicode specs, but fixing this would
+ // require refactoring the code and would cause behavioral regressions.
+ bool isBreakableSpace = lbh.currentPosition < eng->layoutData->string.length()
+ && attributes[lbh.currentPosition].whiteSpace
+ && eng->layoutData->string.at(lbh.currentPosition).decompositionTag() != QChar::NoBreak;
+
if (lbh.currentPosition >= eng->layoutData->string.length()
- || attributes[lbh.currentPosition].whiteSpace
+ || isBreakableSpace
|| attributes[lbh.currentPosition].lineBreak) {
sb_or_ws = true;
break;