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

QFont(family) and QFont::setFamily() give different results

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • P2: Important
    • Some future release
    • 4.5.3, 4.6.0
    • GUI: Font handling
    • None
    • Windows XP, MSVC2008

    Description

      The QFontMetrics is different for a font that has been created with a family name in the constructor and for a font that has this value set by QFont::setFamily() on Windows.

      #include <QtGui>
      
      int main(int argc, char *argv[])
      {
          QApplication app(argc, argv);
      
          QFont f1("Times");
          qDebug() << f1.family() << " xHeight: " << QFontMetrics(f1).xHeight();
          // "Times"  xHeight:  4 
      
          QFont f2;
          f2.setFamily("Times");
          qDebug() << f2.family() << " xHeight: " << QFontMetrics(f2).xHeight();
          // "Times"  xHeight:  3
      
          return 0;
      }
      

      This probably causes problems when "ex" unit is used in stylesheets.

      Attachments

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

        Activity

          People

            esabraha Eskil Abrahamsen Blomfeldt
            mpejcoch Martin Pejcoch (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes