Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-72890

QPainterPath::addText ignores BIDI reordering

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.11.1
    • None
    • Linux/X11

    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"
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            esabraha Eskil Abrahamsen Blomfeldt
            razrfalcon Evgeniy
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes