summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJiang Jiang <jiang.jiang@nokia.com>2011-07-26 14:03:37 (GMT)
committerJiang Jiang <jiang.jiang@nokia.com>2011-07-26 14:03:37 (GMT)
commit2fa986aa670bee0fafb30241f40bb3556594e32b (patch)
tree622716d0e2326ff315066f47c44789e7a64b8806 /src
parentc5eaa8ce8df78de97e2d148af247865dfdee3e90 (diff)
downloadQt-2fa986aa670bee0fafb30241f40bb3556594e32b.zip
Qt-2fa986aa670bee0fafb30241f40bb3556594e32b.tar.gz
Qt-2fa986aa670bee0fafb30241f40bb3556594e32b.tar.bz2
Include trailing space width in RTL text line width
Task-number: QTBUG-15511 Reviewed-by: Eskil
Diffstat (limited to 'src')
-rw-r--r--src/gui/text/qtextlayout.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index 3f0b9e8..05b1d08 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -1917,8 +1917,12 @@ found:
if (line.textWidth > 0 && item < eng->layoutData->items.size())
eng->maxWidth += lbh.spaceData.textWidth;
- if (eng->option.flags() & QTextOption::IncludeTrailingSpaces)
+ // In the latter case, text are drawn with trailing spaces at the beginning
+ // of a line, so the naturalTextWidth should contain the space width
+ if ((eng->option.flags() & QTextOption::IncludeTrailingSpaces) ||
+ (line.width == QFIXED_MAX && eng->isRightToLeft())) {
line.textWidth += lbh.spaceData.textWidth;
+ }
if (lbh.spaceData.length) {
line.length += lbh.spaceData.length;
line.hasTrailingSpaces = true;