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

The DirectWrite font engine isn't used for OpenType CFF fonts, but it should be

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.0.0
    • 4.8.0
    • GUI: Font handling
    • None
    • Windows 7
    • a620b778964158e1e38d780d62cd807276001796

    Description

      There's much documentation on the web about DirectWrite's superior rendering of OpenType CFF fonts (ie. OpenType fonts with Type 1 PostScript outlines). Our users make extensive use of these professional fonts (eg. all Adobe's fonts) so I was a bit disappointed to perceive no improvements when switching on DirectWrite in Qt 4.8.

      I investigated further and discovered that DirectWrite isn't used for non-TrueType fonts, due to logic in loadEngine in qfontdatabase_win.cpp. This checks for TMPF_TRUETYPE in the GDI TEXTMETRIC structure. However, DirectWrite can render any sfnt-format font, whether it be TrueType or CFF, so I think the code should instead check for the presence of a cmap table, like this:

      DWORD cmapTag = MAKE_TAG('c', 'm', 'a', 'p');
      uint cmapTableLength = GetFontData(hdc, cmapTag, 0, 0, 0);
      bool sfnt = cmapTableLength != GDI_ERROR;

      and then switch on sfnt to determine whether it should try using DirectWrite. I tried this locally and the results are good.

      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
              jlarcombe James Larcombe
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes