summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gui/text/qtextlayout.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index f8b0cbc..39a8bb8 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -1720,10 +1720,15 @@ void QTextLine::layout_helper(int maxGlyphs)
goto found;
QFixed x = line.x + line.textWidth + lbh.tmpData.textWidth + lbh.spaceData.textWidth;
- lbh.spaceData.textWidth += eng->calculateTabWidth(item, x);
+ QFixed tabWidth = eng->calculateTabWidth(item, x);
+
+ lbh.spaceData.textWidth += tabWidth;
lbh.spaceData.length++;
newItem = item + 1;
- ++lbh.glyphCount;
+
+ QFixed averageCharWidth = eng->fontEngine(current)->averageCharWidth();
+ lbh.glyphCount += qRound(tabWidth / averageCharWidth);
+
if (lbh.checkFullOtherwiseExtend(line))
goto found;
} else if (current.analysis.flags == QScriptAnalysis::LineOrParagraphSeparator) {