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

Font merging seems to behave incorrectly

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 4.7.0
    • 4.3.4
    • GUI: Font handling
    • None
    • f854d363afb6878f3e5260314545d93b9fad41a9

    Description

      Creating a font and setting its strategy to QFont::NoFontMerging seems to have no effect in some cases.

      For example, Arial does not contain the character 0x0901, however, even with font merging disabled, this character is available seemingly because Mangal was still loaded.

      This also seems to be related to when the style strategy is set. With the following example, if the style strategy is set before QFontInfo::family() is called, QFontMetrics::inFont() returns false. If the style strategy is set after QFontInfo::family() is called, QFontMetrics::inFont() returns true.

      #include <QtGui>
      
      int main(int argc, char **argv)
      {
          QApplication a(argc, argv);
      
          QFont font("Arial", 30);
          QFontInfo fontInfo(font);
          qDebug() << "Actual font used:" << fontInfo.family();
      
          font.setStyleStrategy(QFont::NoFontMerging);
      
          QChar testChar(0x0901);
          QString str;
          str += testChar;
      
          QFontMetrics fm(font);
          bool res = fm.inFont(testChar);
          qDebug() << "inFont result:" << res;
      
          QLabel label;
          label.setFont(font);
          label.setText(str);
          label.show();
      
          return a.exec();
      }
      

      Attachments

        1. GlyphCaching.rar
          3 kB
          Martin Petersson

        Issue Links

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

          Activity

            People

              esabraha Eskil Abrahamsen Blomfeldt
              gpf Shane McLaughlin
              Votes:
              4 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes