Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.11.1
-
None
Description
When drawing an Arabic text via `QPainter::drawText`, the text is drawn right to left. But `QPainterPath::addText` renders it as is, which is incorrect. Moreover, `QPainterPath::addText` has a BIDI handling code, so I assume that this is a bug and not an unsupported feature.
Example:
#include <QtWidgets> class Test : public QWidget { Q_OBJECT protected: void paintEvent(QPaintEvent*) { const QString text("ناتساد SVG 1.1 SE تسا ين لاوط."); QPainter p(this); p.setRenderHint(QPainter::Antialiasing); p.setPen(Qt::black); p.setFont(QFont("Arial", 26)); p.fillRect(rect(), Qt::white); p.drawText(10, p.fontMetrics().height(), text); QPainterPath path; path.addText(10, p.fontMetrics().height() * 2.5, p.font(), text); path.setFillRule(Qt::WindingFill); p.setPen(Qt::NoPen); p.setBrush(Qt::black); p.drawPath(path); } }; int main(int argc, char** argv) { QApplication app(argc, argv); Test t; t.resize(300, 200); t.show(); return app.exec(); } #include "main.moc"