summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qpainter.cpp
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2011-07-13 15:56:21 (GMT)
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2011-07-13 15:56:21 (GMT)
commit41370bc3d87afbb5485d1246dc4bcd8ab6498aa8 (patch)
tree75f87410e58fcaca1f2d239ddc21609bfc1c5211 /src/gui/painting/qpainter.cpp
parenteef8caf294b45c8748cc7c74ddda82bec2869ecf (diff)
parentc3b6b687e340d4d0c65789c3ac80dbaf2eb513b5 (diff)
downloadQt-41370bc3d87afbb5485d1246dc4bcd8ab6498aa8.zip
Qt-41370bc3d87afbb5485d1246dc4bcd8ab6498aa8.tar.gz
Qt-41370bc3d87afbb5485d1246dc4bcd8ab6498aa8.tar.bz2
Merge remote-tracking branch 'mainline/4.8'
Diffstat (limited to 'src/gui/painting/qpainter.cpp')
-rw-r--r--src/gui/painting/qpainter.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index 435e12a..9bd9733 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -6646,6 +6646,10 @@ void QPainter::drawTextItem(const QPointF &p, const QTextItem &_ti)
qreal x = p.x();
qreal y = p.y();
+ bool rtl = ti.flags & QTextItem::RightToLeft;
+ if (rtl)
+ x += ti.width.toReal();
+
int start = 0;
int end, i;
for (end = 0; end < ti.glyphs.numGlyphs; ++end) {
@@ -6662,14 +6666,19 @@ void QPainter::drawTextItem(const QPointF &p, const QTextItem &_ti)
ti2.width += ti.glyphs.effectiveAdvance(i);
}
+ if (rtl)
+ x -= ti2.width.toReal();
+
d->engine->drawTextItem(QPointF(x, y), ti2);
+ if (!rtl)
+ x += ti2.width.toReal();
+
// reset the high byte for all glyphs and advance to the next sub-string
const int hi = which << 24;
for (i = start; i < end; ++i) {
glyphs.glyphs[i] = hi | glyphs.glyphs[i];
}
- x += ti2.width.toReal();
// change engine
start = end;
@@ -6684,6 +6693,9 @@ void QPainter::drawTextItem(const QPointF &p, const QTextItem &_ti)
ti2.width += ti.glyphs.effectiveAdvance(i);
}
+ if (rtl)
+ x -= ti2.width.toReal();
+
if (d->extended)
d->extended->drawTextItem(QPointF(x, y), ti2);
else