src/gui/painting/qpainter.cpp
changeset 29 b72c6db6890b
parent 25 e24348a560a6
child 30 5dc02b23752f
--- a/src/gui/painting/qpainter.cpp	Fri Jun 11 14:24:45 2010 +0300
+++ b/src/gui/painting/qpainter.cpp	Wed Jun 23 19:07:03 2010 +0300
@@ -7806,10 +7806,11 @@
         for (int i = 0; i < textLayout.lineCount(); i++) {
             QTextLine line = textLayout.lineAt(i);
 
+            qreal advance = textLayout.engine()->lines[i].textAdvance.toReal();
             if (tf & Qt::AlignRight)
-                xoff = r.width() - line.naturalTextWidth();
+                xoff = r.width() - advance;
             else if (tf & Qt::AlignHCenter)
-                xoff = (r.width() - line.naturalTextWidth())/2;
+                xoff = (r.width() - advance)/2;
 
             line.draw(painter, QPointF(r.x() + xoff + line.x(), r.y() + yoff));
         }