diff --git a/src/gui/text/windows/qwindowsdirectwritefontdatabase.cpp b/src/gui/text/windows/qwindowsdirectwritefontdatabase.cpp index f2671b6ccf8..66990a563f6 100644 --- a/src/gui/text/windows/qwindowsdirectwritefontdatabase.cpp +++ b/src/gui/text/windows/qwindowsdirectwritefontdatabase.cpp @@ -268,78 +268,6 @@ QSupportedWritingSystems QWindowsDirectWriteFontDatabase::supportedWritingSystem bool QWindowsDirectWriteFontDatabase::populateFamilyAliases(const QString &missingFamily) { - // If the font has not been populated, it is possible this is a legacy font family supported - // by GDI. We make an attempt at loading it via GDI and then add this face directly to the - // database. - if (!missingFamily.isEmpty() - && missingFamily.size() < LF_FACESIZE - && !m_populatedFonts.contains(missingFamily) - && !m_populatedBitmapFonts.contains(missingFamily)) { - qCDebug(lcQpaFonts) << "Loading unpopulated" << missingFamily << ". Trying GDI."; - - LOGFONT lf; - memset(&lf, 0, sizeof(LOGFONT)); - memcpy(lf.lfFaceName, missingFamily.utf16(), missingFamily.size() * sizeof(wchar_t)); - - HFONT hfont = CreateFontIndirect(&lf); - if (hfont) { - HDC dummy = GetDC(0); - HGDIOBJ oldFont = SelectObject(dummy, hfont); - - DirectWriteScope directWriteFontFace; - if (SUCCEEDED(data()->directWriteGdiInterop->CreateFontFaceFromHdc(dummy, &directWriteFontFace))) { - DirectWriteScope fontCollection; - if (SUCCEEDED(data()->directWriteFactory->GetSystemFontCollection(&fontCollection))) { - DirectWriteScope font; - if (SUCCEEDED(fontCollection->GetFontFromFontFace(*directWriteFontFace, &font))) { - - DirectWriteScope font2; - if (SUCCEEDED(font->QueryInterface(__uuidof(IDWriteFont2), - reinterpret_cast(&font2)))) { - DirectWriteScope names; - if (SUCCEEDED(font2->GetFaceNames(&names))) { - wchar_t englishLocale[] = L"en-us"; - QString englishLocaleStyleName = localeString(*names, englishLocale); - - QFont::Stretch stretch = fromDirectWriteStretch(font2->GetStretch()); - QFont::Style style = fromDirectWriteStyle(font2->GetStyle()); - QFont::Weight weight = fromDirectWriteWeight(font2->GetWeight()); - bool fixed = font2->IsMonospacedFont(); - bool isColorFont = font2->IsColorFont(); - - - QSupportedWritingSystems writingSystems = supportedWritingSystems(*directWriteFontFace); - - qCDebug(lcQpaFonts) << "Registering legacy font family" << missingFamily; - QPlatformFontDatabase::registerFont(missingFamily, - englishLocaleStyleName, - QString(), - weight, - style, - stretch, - false, - true, - 0xffff, - fixed, - isColorFont, - writingSystems, - new FontHandle(*directWriteFontFace, missingFamily)); - - SelectObject(dummy, oldFont); - DeleteObject(hfont); - - return true; - } - } - } - } - } - - SelectObject(dummy, oldFont); - DeleteObject(hfont); - } - } - // Skip over implementation in QWindowsFontDatabase return QWindowsFontDatabaseBase::populateFamilyAliases(missingFamily); }