Fix registration of system default font

QPlatformFontDatabase::resolveFontFamilyAlias returns the input
unchanged if the font-name is not found. This means we never register
the system default font when it is only a virtual font name.

Task-number: QTBUG-58225
Change-Id: Ib4f80bb758aa66a163d223573bfe624bb3c134ab
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
This commit is contained in:
Allan Sandfeld Jensen 2017-01-17 13:24:57 +01:00 committed by Jani Heikkinen
parent 88932d4339
commit 1e7ce7aab0
2 changed files with 2 additions and 2 deletions

View File

@ -1191,7 +1191,7 @@ void QWindowsFontDatabase::populateFontDatabase()
ReleaseDC(0, dummy);
// Work around EnumFontFamiliesEx() not listing the system font.
QString systemDefaultFamily = QWindowsFontDatabase::systemDefaultFont().family();
if (QPlatformFontDatabase::resolveFontFamilyAlias(systemDefaultFamily).isEmpty())
if (QPlatformFontDatabase::resolveFontFamilyAlias(systemDefaultFamily) == systemDefaultFamily)
QPlatformFontDatabase::registerFontFamily(systemDefaultFamily);
}

View File

@ -386,7 +386,7 @@ void QWindowsFontDatabaseFT::populateFontDatabase()
ReleaseDC(0, dummy);
// Work around EnumFontFamiliesEx() not listing the system font
QString systemDefaultFamily = QWindowsFontDatabase::systemDefaultFont().family();
if (QPlatformFontDatabase::resolveFontFamilyAlias(systemDefaultFamily).isEmpty())
if (QPlatformFontDatabase::resolveFontFamilyAlias(systemDefaultFamily) == systemDefaultFamily)
QPlatformFontDatabase::registerFontFamily(systemDefaultFamily);
}