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

QPainterPath::addText() does not respect QFont::SmallCaps

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 6.2.1
    • 4.7.0, 5.11
    • GUI: Text handling
    • None
    • Qt/X11
    • f7bbea791e6218de078016bd9e3b92453c6a491f (qt/tqtc-qtbase/6.2.1)

    Description

      Passing a font with capitalization() == QFont::SmallCaps to QPainterPath::addText() will create a path of same-size all-caps text.
      It appears the glyphs are positioned with regard to QFont::SmallCaps, but they're all the same size.

      test.cpp
      #include <QtGui>
      
      class Test : public QWidget
      {
          Q_OBJECT
      public:
          void paintEvent(QPaintEvent*)
          {
              QPainter painter(this);
              painter.fillRect(rect(), Qt::white);
      
              QFont font("Arial", 40);
              font.setCapitalization(QFont::SmallCaps);
      
              QPainterPath path;
              path.addText(0, 60, font, "Hello Qt");
              painter.strokePath(path, QPen(Qt::black));
          }
      };
      
      int main(int argc, char** argv)
      {
          QApplication app(argc, argv);
          Test t;
          t.resize(300, 200);
          t.show();
          return app.exec();
      }
      
      #include "test.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
            akling Andreas Kling (closed Nokia identity) (Inactive)
            Votes:
            4 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes