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

offscreen QPA does not initialise font database

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3: Somewhat important
    • Resolution: Done
    • Affects Version/s: 5.9.7
    • Fix Version/s: 5.9
    • Component/s: GUI: Font handling
    • Labels:
      None
    • Platform/s:
      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

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

          Activity

            People

            Assignee:
            esabraha Eskil Abrahamsen Blomfeldt
            Reporter:
            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