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

QFontMetrics::inFont() on Windows returns true even if Qt doesn't find a font that can render the character

    XMLWordPrintable

Details

    Description

      Reproducible with the following code, which displays only replacement-characters on Windows:

      #include <iostream>
      #include <QtGui/QLabel>
      #include <QtGui/QApplication>

      int main (int argc, char **argv)
      {
      QApplication app (argc, argv);

      QFont f ("Verdana");
      // f.setStyleStrategy(QFont::NoFontMerging);
      QFontMetrics fm (f);

      QString text1;
      QString text2;

      for (int i = 8305; i < 8317; ++i)

      { bool in_font = fm.inFont (i); text1 += QChar (i); text2 += QString ("\n%1 is in font: %2") .arg (i).arg (in_font? "yes" : "no"); }

      QLabel *label = new QLabel;
      label->setText (text1 + text2);

      label->setFont (f);
      label->show ();
      return app.exec ();
      }

      Turning font merging off by commenting in the line shows the correct result from the call to inFont.

      Attachments

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

        Activity

          People

            Unassigned Unassigned
            vhilshei Volker Hilsheimer
            Votes:
            3 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes