diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2011-07-06 09:44:57 (GMT) |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2011-07-06 10:24:20 (GMT) |
commit | e5e1ff0d6f4e6a8457da61b5b215730de6f960bd (patch) | |
tree | 9e47ce62bce45a3ecde99362687c3e94a16fd3cd /src/gui/painting | |
parent | eecc9d287c6d9db62b24ee2c80eb994a5552e41f (diff) | |
download | Qt-e5e1ff0d6f4e6a8457da61b5b215730de6f960bd.zip Qt-e5e1ff0d6f4e6a8457da61b5b215730de6f960bd.tar.gz Qt-e5e1ff0d6f4e6a8457da61b5b215730de6f960bd.tar.bz2 |
Fix bidi reordering when part of text is rendered by fallback font
If the fallback font is used for part of a RTL text, we need to
position the different text items accordingly, subtracting the advance
instead of adding it.
Task-number: QTBUG-17117
Done-with: Lars
Diffstat (limited to 'src/gui/painting')
-rw-r--r-- | src/gui/painting/qpainter.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index a4ab00a..604c1ab 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -6512,6 +6512,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) { @@ -6528,14 +6532,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; @@ -6550,6 +6559,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 |