diff --git a/src/gui/text/windows/qwindowsdirectwritefontdatabase.cpp b/src/gui/text/windows/qwindowsdirectwritefontdatabase.cpp index 610cd1d64b0..bd09597ba63 100644 --- a/src/gui/text/windows/qwindowsdirectwritefontdatabase.cpp +++ b/src/gui/text/windows/qwindowsdirectwritefontdatabase.cpp @@ -265,75 +265,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 font1; - if (SUCCEEDED(font->QueryInterface(__uuidof(IDWriteFont1), - reinterpret_cast(&font1)))) { - DirectWriteScope names; - if (SUCCEEDED(font1->GetFaceNames(&names))) { - wchar_t englishLocale[] = L"en-us"; - QString englishLocaleStyleName = localeString(*names, englishLocale); - - QFont::Stretch stretch = fromDirectWriteStretch(font1->GetStretch()); - QFont::Style style = fromDirectWriteStyle(font1->GetStyle()); - QFont::Weight weight = fromDirectWriteWeight(font1->GetWeight()); - bool fixed = font1->IsMonospacedFont(); - - QSupportedWritingSystems writingSystems = supportedWritingSystems(*directWriteFontFace); - - qCDebug(lcQpaFonts) << "Registering legacy font family" << missingFamily; - QPlatformFontDatabase::registerFont(missingFamily, - englishLocaleStyleName, - QString(), - weight, - style, - stretch, - false, - true, - 0xffff, - fixed, - 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); }