summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qtextlayout.cpp
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2014-07-10 10:11:10 +0200
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2014-07-10 10:11:11 +0200
commitf035786021e9f7b1d9512b22774bc15553caaedb (patch)
treec46a29ed3657944d9f36d8643a99fad469235bc4 /src/gui/text/qtextlayout.cpp
parent72024fd50cdead8d890886dba32fd81ac54ff3ae (diff)
parent916c9d469bd0df227dc3be97fcca27e3cf58144f (diff)
Merge remote-tracking branch 'origin/5.3' into dev
Diffstat (limited to 'src/gui/text/qtextlayout.cpp')
-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 a48fef7e8b..435ef2637d 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -1843,8 +1843,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;