Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.9.7
-
None
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 |
247551,3 | Offscreen QPA: use a CoreText font database on macOS | 5.12 | qt/qtbase | Status: MERGED | +2 | 0 |
248095,2 | Offscreen QPA: use a CoreText font database on macOS | 5.9 | qt/qtbase | Status: MERGED | +2 | 0 |