diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2010-05-27 11:14:20 (GMT) |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2010-05-27 11:14:20 (GMT) |
commit | 3f74a095086f49be23f526a5adc7e65687a19c31 (patch) | |
tree | 982e7ba26f31d07bc48b7a3be98ad07f6364a807 | |
parent | 4085d3eef59763b91ae63818b5885e1027eef3c1 (diff) | |
download | Qt-3f74a095086f49be23f526a5adc7e65687a19c31.zip Qt-3f74a095086f49be23f526a5adc7e65687a19c31.tar.gz Qt-3f74a095086f49be23f526a5adc7e65687a19c31.tar.bz2 |
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.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index d4cb230..c5dd854 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; } |