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

OpenType font embedding in PostScript / PDF

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 4.6.2
    • None

    Description

      From perusing the Qt source, this seems to be supported: QPdfBaseEnginePrivate::drawTextItem(..) sets up the QFontSubset and writes out the text, and the font is later embedded in QPSPrintEnginePrivate::emitPages() (and flushPage(..)) by calling QFontSubset::toType1().

      However, in practice this isn't working.
      The font is never embedded because it has an empty faceId, which is tested for in QPdfBaseEnginePrivate::drawTextItem(..). After digging around, I discovered that this is due to what seems like a bug in QFontEngineWin.

      When QFontEngineWin::getCmap is called from the constructor, the cmap table is only retrieved for actual TrueType fonts, i.e. when the Win32 API supplies TMPF_TRUETYPE as part of the tmPitchAndFamily in the TEXTMETRIC structure. This is also the condition for setting the 'ttf' member variable, which is later checked by getSfntTable (amongst others). However, OpenType fonts share the basic sfnt file format of TrueType fonts, and a cmap table can therefore be loaded. This would result in the faceId getting set correctly in the QFontEngineWin constructor, as required for PS/PDF font embedding.

      Attached is a small reproducable case.

      JL 11-6-10: The lack of support for OpenType PS font's cmap tables was causing other problems - see QTBUG-11387. I've fixed it locally. My patch is attached to QTBUG-11387 but also resolves this bug.

      Attachments

        Issue Links

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

          Activity

            People

              Unassigned Unassigned
              xcm Martin Petersson (Inactive)
              Votes:
              5 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes