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

Kerning with 'kern' table fails for OpenType PS fonts on Windows

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P3: Somewhat important
    • 5.2.1
    • 4.6.2, 5.3.2, 5.4.0 RC
    • GUI: Text handling
    • None
    • Windows, Linux

    Description

      OpenType fonts with Type 1 (PS) outlines don't currently kern correctly in Qt on Windows with either the TT-style 'kern' table or the OpenType 'GPOS'. I think these bugs have quite different causes so I'll file them separately.

      To reproduce the 'kern' table problem, try installing the attached font (Opus Function Symbols) and draw "Tg" in that font at a large point size. The font specifies kerning for this pair in its 'kern' table, but it doesn't get applied when the text is drawn. (This is a rather odd font for a specific purpose in our application, but the problem is a general one.)

      Digging through the code, the problem seems to be that the 'kerning' static in QFontEngine.cpp is being called with character codes, not glyph IDs. This means that it never matches against the entries in the 'kern' table. The root cause is the same as QTBUG-10089, namely that OpenType PS fonts are not being treated the same as OpenType TT fonts in QFontEngineWin. Their cmap is not loaded and several important code paths are never taken, meaning in this case that we don't map to glyph IDs correctly in QFontEngine::doKerning.

      I've fixed this locally by generalising the code for 'TrueType' fonts in QFontEngineWin and its base class to apply to all sfnt-based fonts with a cmap (ie, TT, OpenType TT and OpenType PS). See the attached patch file against 4.7-stable, which also fixes QTBUG-10089.

      Attachments

        Issue Links

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

          Activity

            People

              Unassigned Unassigned
              jlarcombe James Larcombe
              Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes