summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2010-05-27 13:14:20 +0200
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2010-05-27 13:14:20 +0200
commit3f74a095086f49be23f526a5adc7e65687a19c31 (patch)
tree982e7ba26f31d07bc48b7a3be98ad07f6364a807
parent4085d3eef59763b91ae63818b5885e1027eef3c1 (diff)
Fix regression with Qt::AlignRight on monospaced text in QTextLayout
For monospaced fonts, using the width (including the bearing) of the text to align it to the right hand side, will break alignment of columns of characters. To fix the problem, we go back to the old procedure, by using the advance of the text as basis of alignment instead. Done-by: thorbjorn Reviewed-by: Eskil
-rw-r--r--src/gui/text/qtextlayout.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index d4cb23037c..c5dd854c56 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -89,9 +89,9 @@ static QFixed alignLine(QTextEngine *eng, const QScriptLine &line)
if (align & Qt::AlignJustify && eng->option.textDirection() == Qt::RightToLeft)
align = Qt::AlignRight;
if (align & Qt::AlignRight)
- x = line.width - (line.textWidth + leadingSpaceWidth(eng, line));
+ x = line.width - (line.textAdvance + leadingSpaceWidth(eng, line));
else if (align & Qt::AlignHCenter)
- x = (line.width - line.textWidth)/2;
+ x = (line.width - line.textAdvance)/2;
}
return x;
}