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

QPainter renders crooked text

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P4: Low
    • None
    • 5.12.3
    • GUI: Painting
    • None
    • Windows

    Description

      QPainter renders crooked text.
      In attached image, left 'Unable to render embedded object: File (' is rendered by QPainter and right ') not found.' is captured from MS PowerPoint.
      The font family is 'Noto Sans' and point size is 60.

      You can see that left one is crooked while right one is perfectly symmetric.

      Left one is rendered by next code:

      #include <QtGui>
      
      auto main(int argc, char **argv) -> int
      {
      QGuiApplication app{argc, argv};
      QImage image{100, 100, QImage::Format_RGB32};
      QFont font{"Noto Sans"};
      font.setPointSize(60);
      QPainter painter{&image};
      painter.fillRect(image.rect(), Qt::white);
      painter.setFont(font);
      painter.setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing);
      painter.drawText(image.rect(), Qt::AlignCenter, "!");
      painter.end();
      image.save("D:/test-alpha.png");
      return 0;
      }
      

      Attachments

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

        Activity

          People

            vgt Eirik Aavitsland
            xylosper Byoung-young Lee
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes