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

Diacritics are not rendered for OpenType font on Windows.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 4.6.1
    • 4.5.3, 4.6.0
    • GUI: Font handling
    • None
    • 6ef5b4485b9fe5a9d25d2d9b5e67f110fb728a8b

    Description

      To reproduce the bug, install the attached font and run the following program:

      #include <QtGui>
      
      int main(int argc, char **argv)
      {
          QApplication app(argc, argv);
          QFile file(QLatin1String("testutf8.txt"));
          if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
              return 1;
          QTextDocument doc;
          QByteArray content = file.readAll();
          file.close();
          doc.setDefaultFont(QFont("Old Standard", 16));
          doc.setPlainText(QString::fromUtf8(content.data(), content.size()));
          QTextEdit w;
          w.setDocument(&doc);
          w.show();
          return app.exec();
      }
      

      If you open the text file in a non-Qt text editor using the same font, you'll see that there are some diacritics which are not rendered by the above Qt program. This is a regression from Qt 4.4.

      Part of the problem is that QFontEngineWin::boundingBox(glyph_t, const QTransform &) returns 0 as the bounding box' lower x-coordinate instead of abc.abcfA. Therefore, when Qt asks Windows to render the diacritic glyph into an image (for the glyph cache), the glyph is rendered mostly outside the image.

      Another problem is that the diacritics are placed incorrectly on the screen, sometimes two lines above the correct position. QFontEngine::getGlyphPositions() adds the glyph's offset to its base position, but if the offset it ignored, the position is much closer to correct.

      Attachments

        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
              kkalland Kim Motoyoshi Kalland (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes