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

Assertion failure for some (bad) fonts

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.9.0 Beta3
    • GUI: Font handling
    • None
    • Windows

    Description

      I tested google's nanoemoji to create emoji fonts. It generates some good fonts (COLRv0 and COLRv1) but it can also generate fonts that don't display in browsers (CBDT and SBIX versions).

      Even though the fonts "don't work", they shouldn't cause an assertion failure. I attached a minimal reproduction with the fonts below. The failure happens when calling qNextPowerOfTwo(static_cast<quint32>(-1)) from QTextureGlyphCache::fillInPendingGlyphs (line 225 at v6.9.0-beta3), because requiredHeight is zero.

      #include <QApplication>
      #include <QFontDatabase>
      #include <QPainter>
      
      int main(int argc, char **argv) {
        QApplication app(argc, argv);
      
        QImage img(10, 10, QImage::Format_ARGB32);
        QPainter p(&img);
      
        int idCbdt = QFontDatabase::addApplicationFont("bad-cbdt.ttf");
        p.setFont(QFont(QFontDatabase::applicationFontFamilies(idCbdt)[0]));
        p.drawText(0, 0, " 😂"); // note the space in the string
      
        int idSbix = QFontDatabase::addApplicationFont("bad-sbix.ttf");
        p.setFont(QFont(QFontDatabase::applicationFontFamilies(idSbix)[0]));
        p.drawText(0, 0, " 😂");
      }
      

      Attachments

        1. bad-cbdt.ttf
          6.01 MB
          Tom Fors
        2. bad-sbix.ttf
          6.01 MB
          Tom Fors
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            esabraha Eskil Abrahamsen Blomfeldt
            nerixyz Tom Fors
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes