summaryrefslogtreecommitdiffstats
path: root/src/openvg
diff options
context:
space:
mode:
authorAlessandro Portale <alessandro.portale@nokia.com>2010-04-16 13:56:15 (GMT)
committerAlessandro Portale <alessandro.portale@nokia.com>2010-04-16 13:56:15 (GMT)
commitc1bf30182b100f2dc83ec552685869990b02b23d (patch)
tree51534ca38d1349218ad03144c7edcf3f74329b08 /src/openvg
parentc7d102658ec96e6e2ed168392d9e6381534d6660 (diff)
downloadQt-c1bf30182b100f2dc83ec552685869990b02b23d.zip
Qt-c1bf30182b100f2dc83ec552685869990b02b23d.tar.gz
Qt-c1bf30182b100f2dc83ec552685869990b02b23d.tar.bz2
Fix RTL text rendering in the QVGPaintEngine
The QVGPaintEngine calls vgDrawGlyphs() to draw the glyphs of a QTextItem. vgDrawGlyphs(), which is an official OpenVG function, and not implemented in Qt itself, expects glyphs coordinates differently than Qt's glyph painting loops of other paint engines expect. Therefore, we need to handle RTL text separately in QVGPaintEngine::drawTextItem(). Rhys Weatherley provided this patch. This issue is not Symbian specific, but rather QVGPaintEngine specific. Task-number: QT-3140 Reviewed-by: Rhys Weatherley
Diffstat (limited to 'src/openvg')
-rw-r--r--src/openvg/qpaintengine_vg.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp
index 96e0e86..7445fd7 100644
--- a/src/openvg/qpaintengine_vg.cpp
+++ b/src/openvg/qpaintengine_vg.cpp
@@ -3347,8 +3347,13 @@ void QVGPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem)
// Draw the glyphs. We need to fill with the brush associated with
// the Qt pen, not the Qt brush.
d->ensureBrush(state()->pen.brush());
- vgDrawGlyphs(glyphCache->font, glyphs.size(), (VGuint*)glyphs.data(),
- NULL, NULL, VG_FILL_PATH, VG_TRUE);
+ if (ti.renderFlags() & QTextItem::RightToLeft) {
+ for (int index = glyphs.size() - 1; index >= 0; --index)
+ vgDrawGlyph(glyphCache->font, glyphs[index], VG_FILL_PATH, VG_TRUE);
+ } else {
+ vgDrawGlyphs(glyphCache->font, glyphs.size(), (VGuint*)glyphs.data(),
+ NULL, NULL, VG_FILL_PATH, VG_TRUE);
+ }
#else
// OpenGL 1.0 does not have support for VGFont and glyphs,
// so fall back to the default Qt path stroking algorithm.