diff -r e24348a560a6 -r b72c6db6890b src/gui/text/qtextlayout.cpp --- a/src/gui/text/qtextlayout.cpp Fri Jun 11 14:24:45 2010 +0300 +++ b/src/gui/text/qtextlayout.cpp Wed Jun 23 19:07:03 2010 +0300 @@ -89,9 +89,9 @@ 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; } @@ -1928,6 +1928,7 @@ found: if (lbh.rightBearing > 0) // If right bearing has not yet been adjusted lbh.adjustRightBearing(); + line.textAdvance = line.textWidth; line.textWidth -= qMin(QFixed(), lbh.rightBearing); if (line.length == 0) {