summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qpainter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/painting/qpainter.cpp')
-rw-r--r--src/gui/painting/qpainter.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index be5c41ce76..d5b9f97378 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -1291,7 +1291,7 @@ void QPainterPrivate::updateState(QPainterState *newState)
\o \inlineimage qpainter-compositiondemo.png
\o
- \bold {Composition Modes Demo}
+ \bold {Composition Modes Example}
The \l {painting/composition}{Composition Modes} example, available in
Qt's examples directory, allows you to experiment with the various
@@ -6503,6 +6503,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) {
@@ -6519,14 +6523,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;
@@ -6541,6 +6550,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