diff options
-rw-r--r-- | src/gui/text/qtextlayout.cpp | 6 |
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; |