summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms/windows/qwindowsfontdatabase.cpp')
-rw-r--r--src/plugins/platforms/windows/qwindowsfontdatabase.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
index ef74ef35f5..56adae8ffb 100644
--- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
@@ -1674,8 +1674,10 @@ QFontEngine *QWindowsFontDatabase::createEngine(const QFontDef &request,
HFONT hfont = 0;
hfont = CreateFontIndirect(&lf);
- if (!hfont)
+ if (!hfont) {
qErrnoWarning("%s: CreateFontIndirect failed", __FUNCTION__);
+ hfont = QWindowsFontDatabase::systemFont();
+ }
bool ttf = false;
int avWidth = 0;
@@ -1689,18 +1691,17 @@ QFontEngine *QWindowsFontDatabase::createEngine(const QFontDef &request,
SelectObject(data->hdc, oldObj);
if (!useDirectWrite) {
- if (hfont && (!ttf || request.stretch != 100)) {
+ if (!ttf || request.stretch != 100) {
DeleteObject(hfont);
if (!res)
qErrnoWarning("%s: GetTextMetrics failed", __FUNCTION__);
lf.lfWidth = avWidth * request.stretch/100;
hfont = CreateFontIndirect(&lf);
- if (!hfont)
+ if (!hfont) {
qErrnoWarning("%s: CreateFontIndirect with stretch failed", __FUNCTION__);
+ hfont = QWindowsFontDatabase::systemFont();
+ }
}
-
- if (!hfont)
- hfont = QWindowsFontDatabase::systemFont();
}
#if !defined(QT_NO_DIRECTWRITE)