summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
diff options
context:
space:
mode:
authorKonstantin Ritt <ritt.ks@gmail.com>2014-11-24 06:53:23 +0400
committerKonstantin Ritt <ritt.ks@gmail.com>2015-02-12 10:05:27 +0000
commit7997e56a2e5f35fa19da9ccb5dc89586882d951b (patch)
tree0ee8f46ecc56ebf9813a9b1e80aded7e3264a9c6 /src/plugins/platforms/windows/qwindowsfontdatabase.cpp
parent01203a94b567be144731a0c5236478e464a794d3 (diff)
[QWindowsFont*] Unify HFONT fallbacks
In case CreateFontIndirect() call fails, always fallback to a better stock font provided by Windows (apparently, it is DEFAULT_GUI_FONT). Change-Id: Ib78fe0d21ba4fccbba1152b81ed87c010e1220e0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Diffstat (limited to 'src/plugins/platforms/windows/qwindowsfontdatabase.cpp')
-rw-r--r--src/plugins/platforms/windows/qwindowsfontdatabase.cpp11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
index 7aa23059d4..5ab32ebe03 100644
--- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
@@ -1422,7 +1422,7 @@ void QWindowsFontDatabase::refUniqueFont(const QString &uniqueFont)
HFONT QWindowsFontDatabase::systemFont()
{
- static const HFONT stock_sysfont = (HFONT)GetStockObject(SYSTEM_FONT);
+ static const HFONT stock_sysfont = (HFONT)GetStockObject(DEFAULT_GUI_FONT);
return stock_sysfont;
}
@@ -1706,13 +1706,8 @@ QFontEngine *QWindowsFontDatabase::createEngine(const QFontDef &request,
qErrnoWarning("%s: CreateFontIndirect with stretch failed", __FUNCTION__);
}
-#ifndef Q_OS_WINCE
- if (hfont == 0)
- hfont = (HFONT)GetStockObject(ANSI_VAR_FONT);
-#else
if (hfont == 0)
- hfont = (HFONT)GetStockObject(SYSTEM_FONT);
-#endif
+ hfont = QWindowsFontDatabase::systemFont();
}
#if !defined(QT_NO_DIRECTWRITE)
@@ -1782,7 +1777,7 @@ static inline int verticalDPI()
QFont QWindowsFontDatabase::systemDefaultFont()
{
LOGFONT lf;
- GetObject(GetStockObject(DEFAULT_GUI_FONT), sizeof(lf), &lf);
+ GetObject(QWindowsFontDatabase::systemFont(), sizeof(lf), &lf);
QFont systemFont = QWindowsFontDatabase::LOGFONT_to_QFont(lf);
// "MS Shell Dlg 2" is the correct system font >= Win2k
if (systemFont.family() == QLatin1String("MS Shell Dlg"))