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

Test layout bug with justified text. Seems related to non-latin-1 characters

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 4.7.1
    • 4.4.0, 4.4.1, 4.4.2, 4.4.3, 4.5.0, 4.5.1, 4.5.2, 4.5.3, 4.6.0, 4.6.1, 4.6.2, 4.7.0
    • GUI: Text handling
    • None
    • Reproduced on Linux and Windows
    • 1bdd2553b744de425b5952d2e9ab31753cd5b110

    Description

      When drawing the text of WebKit with "justify" alignment, the layout of the text can be wrong.
      This seem to be happening mainly with non-latin-1 characters, greek in this example, a bug have also been reported for arabic.

      #include <QtGui>
      
      class MyWidget : public QWidget
      {
      protected:
          void paintEvent(QPaintEvent *)
          {
              QPainter painter(this);
              painter.setFont(QFont("arial"));
              painter.drawText(QPointF(50, 50), QString::fromUtf8("Bei Bei Bei Bei Bei Bei Bei Bei Bei Bei Bei Bei Bei Bei Bei Bei α Bei Bei Bei Bei Bei Bei Bei Bei Bei Bei Bei"), Qt::TextForceLeftToRight, 220);
              painter.drawText(QPointF(50, 100), QString::fromUtf8("Bei Bei Bei Bei Bei Bei Bei Bei Bei Bei Bei Bei Bei Bei Bei Bei Bei Bei Bei Bei Bei Bei Bei Bei Bei Bei Bei"), Qt::TextForceLeftToRight, 220);
              painter.drawText(QPointF(50, 150), QString::fromUtf8(" Bei α Bei "), Qt::TextForceLeftToRight, 220);
      
          }
      };
      
      int main(int argc, char **argv)
      {
          QApplication app(argc, argv);
          MyWidget m;
          m.show();
          return app.exec();
      }
      

      Attachments

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

        Activity

          People

            esabraha Eskil Abrahamsen Blomfeldt
            poulain Benjamin Poulain (closed Nokia identity) (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes