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

offscreen QPA does not initialise font database

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.9
    • 5.9.7
    • GUI: Font handling
    • None
    • macOS

    Description

      On Mac, the offscreen QPA does not initialise the font database properly. This makes it impossible to write a Qt-based image conversion utility that will run on headless servers, like the ksvg2icns tool used in KDE's extra-cmake-modules to generate application icons. More precisely: this kind of tool will fail if text rendering is required during the conversion, as can be the case for SVG files .

       

      A slightly modified demonstrator version of this utility: github.com/RJVB/ksvg2icns

      `> ksvg2icns <svg file>`

      (an example "konsole.svg" file is included)

      • called as is on Mac the text will be rendered as black rectangles (the "offscreen" QPA is used by default).
      • called with QT_QPA_PLATFORM=cocoa text will be rendered correctly
      • called as is with Qt built for X11/XCB the conversion will fail but the application will leave its temporary directory containing intermediate png files. These files have properly rendered text.

       

      This appears to be easy to fix in qoffscreenintegration.cpp by creating a new `QCoreTextFontDatabaseEngineFactory<QCoreTextFontEngine>` instance instead of a QPlatformFontDatabase instance.

       

      Curiously this is done in the `minimal` QPA, but that one doesn't allow correct text rendering on neither Mac nor Linux.

      Attachments

        For Gerrit Dashboard: QTBUG-72335
        # Subject Branch Project Status CR V

        Activity

          People

            esabraha Eskil Abrahamsen Blomfeldt
            rjvbertin René Bertin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes