Revert "Fix font enumeration, with the same family name, on Windows."

This reverts commit 8456adf0ee.

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>
This commit is contained in:
Friedemann Kleint 2015-01-21 13:23:41 +01:00
parent 03dc2b2e82
commit 5b1da97b6b
2 changed files with 4 additions and 68 deletions

View File

@ -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);
}

View File

@ -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);
}