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

Regression in pdf printing font subsetting in Qt Webengine 5.15.2

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • None
    • 5.15.2
    • WebEngine
    • None
    • Linux getafix 5.9.2-arch1-1 #1 SMP PREEMPT Thu, 29 Oct 2020 17:01:28 +0000 x86_64 GNU/Linux
    • Linux/X11
    • dfe93385f41c8ad2f53ca3fe454812d68a25be17 (qt/qtwebengine-chromium/83-based) c4fb092e91939de89112dcfb11e870b608c8a52e (qt/qtwebengine-chromium/87-based)

    Description

      Fonts used while printing to pdf are no longer being subset leading to much larger output file sizes. This is a regression from 5.15.1 to 5.15.2. Below is a trivial 5 line test script using PyQt to replicate. When run against Qt 5.15.1 it produces a 12KB PDF, when run against Qt 5.15.2 it produces a 207KB pdf. Using any tool to examine the PDF shows the difference is caused by a much larger embedded font. You can use, for example, mutool extract to verify this. The attached example simply creates a PDF with three letters in it, abc, rendered using the free Liberation Serif font.

       

      ```

      from PyQt5.QtWebEngineWidgets import QWebEnginePage
      from PyQt5.Qt import QApplication
      app = QApplication([])
      p = QWebEnginePage()
      p.pdfPrintingFinished.connect(app.quit)

      p.loadFinished.connect(lambda ok: p.printToPdf('test.pdf'))
      p.setHtml('''<p style="font-family: 'Liberation Serif'">abc''')
      app.exec_()

      ```

      Am sure this can be trivially converted to C++. Have tested it on Linux and macOS but probably exists on other platforms too.

      Attachments

        Issue Links

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

          Activity

            People

              pvarga Peter Varga
              kovidgoyal Kovid Goyal
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes