From 5b1da97b6b4a011f9ce5582869a7a957f6f1369c Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 21 Jan 2015 13:23:41 +0100 Subject: 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 --- .../platforms/windows/qwindowsfontdatabase_ft.cpp | 36 ++-------------------- 1 file changed, 2 insertions(+), 34 deletions(-) (limited to 'src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp') 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(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); } -- cgit v1.2.3