Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.7.0
-
None
-
Linux x64
Description
The following code snippet results an empty string:
QFont font;
font.setStyleHint(QFont::Serif);
qDebug() << font.defaultFamily();
The issue seems to be Linux specific. I tested it on Windows where QFont::defaultFamily() works as expected. During debugging I found that QGuiApplicationPrivate::platformIntegration()>fontDatabase()>fallbacksForFamily() call always returns an empty list.
As a workaround QFontDatabase can be instantiated before the QFont::setStyleHint() call. That's why the corresponding auto test (tst_QFont::defaultFamily() in tests/auto/gui/text/qfont/tst_qfont.cpp) doesn't detect this issue.
This feature must have worked before because QtWebKit had an auto test which tested this. Currently this test is skipped in QtWebEngine.
Attachments
For Gerrit Dashboard: QTBUG-55222 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
168903,2 | Ensure the fontdatabase is initialized when requesting fallbacks | 5.6 | qt/qtbase | Status: MERGED | +2 | 0 |
169086,2 | Add widget auto test for WebEngineSettings default font families | 5.6 | qt/qtwebengine | Status: ABANDONED | 0 | 0 |
170881,2 | Add widget auto test for WebEngineSettings default font families | 5.8 | qt/qtwebengine | Status: MERGED | +2 | 0 |