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

QFont::PreferNoHinting broken on windows 7 with direcwrite and rotated text

    XMLWordPrintable

Details

    • Bug
    • Resolution: Cannot Reproduce
    • P2: Important
    • None
    • 5.1.1, 5.6.0 Beta
    • None

    Description

      I built Qt 5.1.1 from source on windows 7 using -directwrite and
      when I set QFont::PreferNoHinting I get result as shown in attached picture.

      Using QFont::PreferDefaultHinting or no -directwrite version gets correct picture (but with bad character positioning). And on final picture there is result I get on mac with and I want to get on windows with directwrite (nice smoothing and character positioning).

      this simple program shows issue

      #include <QtWidgets>
      
      class MyWidget : public QWidget
      {
      public:
          MyWidget() : QWidget(0)
          {
          }
      
      protected:
          void paintEvent(QPaintEvent * /*e*/)
          {
              QPainter p(this);
              p.translate(200,200);
              QFont font("Times"); // or any font
              font.setPointSize(12);
              font.setHintingPreference(QFont::PreferNoHinting);
              p.setFont(font);
              for (int i = 0; i < 36; ++i) {
                  p.drawText(80, 0, "Just some text" );
                  p.rotate(10.0);
              }
          }
      };
      
      int main(int argc, char **argv)
      {
          QApplication app(argc, argv);
          MyWidget widget;
          widget.resize(400, 400);
          widget.show();
          return app.exec();
      }
      

      Attachments

        1. mac.png
          mac.png
          212 kB
        2. windowsdefaulthinting.png
          windowsdefaulthinting.png
          170 kB
        3. windowsnohinting.png
          windowsnohinting.png
          144 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            esabraha Eskil Abrahamsen Blomfeldt
            ivang Ivan Golubovic
            Votes:
            3 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes