summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-01-21 13:23:41 +0100
committerFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-01-23 09:41:16 +0100
commit5b1da97b6b4a011f9ce5582869a7a957f6f1369c (patch)
treec9808e0eff67b4679d48d999e254428e6b640eea /src/plugins/platforms/windows
parent03dc2b2e82750d1c531cf00a406368cde4a8928b (diff)
Revert "Fix font enumeration, with the same family name, on Windows."
This reverts commit 8456adf0eeb9df8dd5f0547d4ad5a81888295f03. The change introduces a massive slowdown of the application startup caused by the inner enumeration. Task-number: QTBUG-43774 Task-number: QTBUG-40828 Change-Id: I694938eab93ea409d97537b55e8a025bb7a0e393 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Diffstat (limited to 'src/plugins/platforms/windows')
-rw-r--r--src/plugins/platforms/windows/qwindowsfontdatabase.cpp36
-rw-r--r--src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp36
2 files changed, 4 insertions, 68 deletions
diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
index f15783490e..246032dc94 100644
--- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
@@ -964,31 +964,6 @@ static int QT_WIN_CALLBACK storeFont(ENUMLOGFONTEX* f, NEWTEXTMETRICEX *textmetr
return 1;
}
-static int QT_WIN_CALLBACK storeFontSub(ENUMLOGFONTEX* f, NEWTEXTMETRICEX *textmetric,
- int type, LPARAM namesSetIn)
-{
- Q_UNUSED(textmetric)
- Q_UNUSED(type)
-
- HDC dummy = GetDC(0);
- LOGFONT lf;
- lf.lfCharSet = DEFAULT_CHARSET;
- if (wcslen(f->elfLogFont.lfFaceName) >= LF_FACESIZE) {
- qWarning("%s: Unable to enumerate family '%s'.",
- __FUNCTION__, qPrintable(QString::fromWCharArray(f->elfLogFont.lfFaceName)));
- return 1;
- }
- wmemcpy(lf.lfFaceName, f->elfLogFont.lfFaceName,
- wcslen(f->elfLogFont.lfFaceName) + 1);
- lf.lfPitchAndFamily = 0;
- EnumFontFamiliesEx(dummy, &lf, (FONTENUMPROC)storeFont,
- (LPARAM)namesSetIn, 0);
- ReleaseDC(0, dummy);
-
- // keep on enumerating
- return 1;
-}
-
void QWindowsFontDatabase::populateFontDatabase()
{
m_families.clear();
@@ -1024,15 +999,8 @@ void QWindowsFontDatabase::populate(const QString &family)
wmemcpy(lf.lfFaceName, reinterpret_cast<const wchar_t*>(family.utf16()),
family.size() + 1);
lf.lfPitchAndFamily = 0;
-
- if (family.isEmpty()) {
- EnumFontFamiliesEx(dummy, &lf, (FONTENUMPROC)storeFontSub,
- (LPARAM)&m_families, 0);
- } else {
- EnumFontFamiliesEx(dummy, &lf, (FONTENUMPROC)storeFont,
- (LPARAM)&m_families, 0);
- }
-
+ EnumFontFamiliesEx(dummy, &lf, (FONTENUMPROC)storeFont,
+ (LPARAM)&m_families, 0);
ReleaseDC(0, dummy);
}
diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp
index 42e5a8c6ad..0fc5e0dc0c 100644
--- a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp
@@ -375,31 +375,6 @@ static int QT_WIN_CALLBACK storeFont(ENUMLOGFONTEX* f, NEWTEXTMETRICEX *textmetr
return 1;
}
-static int QT_WIN_CALLBACK storeFontSub(ENUMLOGFONTEX* f, NEWTEXTMETRICEX *textmetric,
- int type, LPARAM namesSetIn)
-{
- Q_UNUSED(textmetric)
- Q_UNUSED(type)
-
- HDC dummy = GetDC(0);
- LOGFONT lf;
- lf.lfCharSet = DEFAULT_CHARSET;
- if (wcslen(f->elfLogFont.lfFaceName) >= LF_FACESIZE) {
- qWarning("%s: Unable to enumerate family '%s'.",
- __FUNCTION__, qPrintable(QString::fromWCharArray(f->elfLogFont.lfFaceName)));
- return 1;
- }
- wmemcpy(lf.lfFaceName, f->elfLogFont.lfFaceName,
- wcslen(f->elfLogFont.lfFaceName) + 1);
- lf.lfPitchAndFamily = 0;
- EnumFontFamiliesEx(dummy, &lf, (FONTENUMPROC)storeFont,
- (LPARAM)namesSetIn, 0);
- ReleaseDC(0, dummy);
-
- // keep on enumerating
- return 1;
-}
-
void QWindowsFontDatabaseFT::populateFontDatabase()
{
m_families.clear();
@@ -434,15 +409,8 @@ void QWindowsFontDatabaseFT::populate(const QString &family)
wmemcpy(lf.lfFaceName, reinterpret_cast<const wchar_t*>(family.utf16()),
family.size() + 1);
lf.lfPitchAndFamily = 0;
-
- if (family.isEmpty()) {
- EnumFontFamiliesEx(dummy, &lf, (FONTENUMPROC)storeFontSub,
- (LPARAM)&m_families, 0);
- } else {
- EnumFontFamiliesEx(dummy, &lf, (FONTENUMPROC)storeFont,
- (LPARAM)&m_families, 0);
- }
-
+ EnumFontFamiliesEx(dummy, &lf, (FONTENUMPROC)storeFont,
+ (LPARAM)&m_families, 0);
ReleaseDC(0, dummy);
}