diff --git a/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase.cpp b/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase.cpp index 9ff50bdf05..40ac46df85 100644 --- a/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase.cpp +++ b/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase.cpp @@ -1264,11 +1264,6 @@ QWindowsFontDatabase::~QWindowsFontDatabase() removeApplicationFonts(); } -QFontEngineMulti *QWindowsFontDatabase::fontEngineMulti(QFontEngine *fontEngine, QChar::Script script) -{ - return new QWindowsMultiFontEngine(fontEngine, script); -} - QFontEngine * QWindowsFontDatabase::fontEngine(const QFontDef &fontDef, void *handle) { const QString faceName(static_cast(handle)); diff --git a/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase_p.h b/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase_p.h index 9d0aa7f723..afba86bbe1 100644 --- a/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase_p.h +++ b/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase_p.h @@ -98,7 +98,6 @@ public: void populateFontDatabase() override; void populateFamily(const QString &familyName) override; - QFontEngineMulti *fontEngineMulti(QFontEngine *fontEngine, QChar::Script script) override; QFontEngine *fontEngine(const QFontDef &fontDef, void *handle) override; QFontEngine *fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference) override; QStringList fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const override; diff --git a/src/platformsupport/fontdatabases/windows/qwindowsfontengine.cpp b/src/platformsupport/fontdatabases/windows/qwindowsfontengine.cpp index 2a41209225..d1d11883c1 100644 --- a/src/platformsupport/fontdatabases/windows/qwindowsfontengine.cpp +++ b/src/platformsupport/fontdatabases/windows/qwindowsfontengine.cpp @@ -1199,120 +1199,6 @@ void QWindowsFontEngine::initFontInfo(const QFontDef &request, } } -/*! - \class QWindowsMultiFontEngine - \brief Standard Windows Multi font engine. - \internal - \ingroup qt-lighthouse-win - - "Merges" several font engines that have gaps in the - supported writing systems. - - Will probably be superseded by a common Free Type font engine in Qt 5.X. -*/ -QWindowsMultiFontEngine::QWindowsMultiFontEngine(QFontEngine *fe, int script) - : QFontEngineMulti(fe, script) -{ -} - -#ifndef QT_NO_DIRECTWRITE -static QString msgDirectWriteFunctionFailed(HRESULT hr, const char *function, - const QString &fam, const QString &substitute) -{ - _com_error error(hr); - QString result; - QTextStream str(&result); - str << function << " failed for \"" << fam << '"'; - if (substitute != fam) - str << " (substitute: \"" << substitute << "\")"; - str << ": error " << hex << showbase << ulong(hr) << ' ' << noshowbase << dec - << ": " << QString::fromWCharArray(error.ErrorMessage()); - return result; -} -#endif // !QT_NO_DIRECTWRITE - -QFontEngine *QWindowsMultiFontEngine::loadEngine(int at) -{ - QFontEngine *fontEngine = engine(0); - QSharedPointer data; - LOGFONT lf; - -#ifndef QT_NO_DIRECTWRITE - if (fontEngine->type() == QFontEngine::DirectWrite) { - QWindowsFontEngineDirectWrite *fe = static_cast(fontEngine); - lf = QWindowsFontDatabase::fontDefToLOGFONT(fe->fontDef, QString()); - - data = fe->fontEngineData(); - } else -#endif - { - QWindowsFontEngine *fe = static_cast(fontEngine); - lf = fe->m_logfont; - - data = fe->fontEngineData(); - } - - const QString fam = fallbackFamilyAt(at - 1); - const int faceNameLength = qMin(fam.length(), LF_FACESIZE - 1); - memcpy(lf.lfFaceName, fam.utf16(), faceNameLength * sizeof(wchar_t)); - lf.lfFaceName[faceNameLength] = 0; - -#ifndef QT_NO_DIRECTWRITE - if (fontEngine->type() == QFontEngine::DirectWrite) { - const QString nameSubstitute = QWindowsFontEngineDirectWrite::fontNameSubstitute(fam); - if (nameSubstitute != fam) { - const int nameSubstituteLength = qMin(nameSubstitute.length(), LF_FACESIZE - 1); - memcpy(lf.lfFaceName, nameSubstitute.utf16(), nameSubstituteLength * sizeof(wchar_t)); - lf.lfFaceName[nameSubstituteLength] = 0; - } - - HFONT hfont = CreateFontIndirect(&lf); - if (hfont == nullptr) { - qErrnoWarning("%s: CreateFontIndirect failed", __FUNCTION__); - } else { - HGDIOBJ oldFont = SelectObject(data->hdc, hfont); - - IDWriteFontFace *directWriteFontFace = nullptr; - QWindowsFontEngineDirectWrite *fedw = nullptr; - HRESULT hr = data->directWriteGdiInterop->CreateFontFaceFromHdc(data->hdc, &directWriteFontFace); - if (SUCCEEDED(hr)) { - Q_ASSERT(directWriteFontFace); - fedw = new QWindowsFontEngineDirectWrite(directWriteFontFace, - fontEngine->fontDef.pixelSize, - data); - fedw->fontDef.weight = fontEngine->fontDef.weight; - if (fontEngine->fontDef.style > QFont::StyleNormal) - fedw->fontDef.style = fontEngine->fontDef.style; - fedw->fontDef.family = fam; - fedw->fontDef.hintingPreference = fontEngine->fontDef.hintingPreference; - fedw->fontDef.stretch = fontEngine->fontDef.stretch; - } else { - qWarning("%s: %s", __FUNCTION__, - qPrintable(msgDirectWriteFunctionFailed(hr, "CreateFontFace", fam, nameSubstitute))); - } - - SelectObject(data->hdc, oldFont); - DeleteObject(hfont); - - if (fedw != nullptr) - return fedw; - } - } -#endif - - // Get here if original font is not DirectWrite or DirectWrite creation failed for some - // reason - - QFontEngine *fe = new QWindowsFontEngine(fam, lf, data); - fe->fontDef.weight = fontEngine->fontDef.weight; - if (fontEngine->fontDef.style > QFont::StyleNormal) - fe->fontDef.style = fontEngine->fontDef.style; - fe->fontDef.family = fam; - fe->fontDef.hintingPreference = fontEngine->fontDef.hintingPreference; - fe->fontDef.stretch = fontEngine->fontDef.stretch; - return fe; -} - bool QWindowsFontEngine::supportsTransformation(const QTransform &transform) const { // Support all transformations for ttf files, and translations for raster fonts diff --git a/src/platformsupport/fontdatabases/windows/qwindowsfontengine_p.h b/src/platformsupport/fontdatabases/windows/qwindowsfontengine_p.h index a151cf7343..2b575a9b45 100644 --- a/src/platformsupport/fontdatabases/windows/qwindowsfontengine_p.h +++ b/src/platformsupport/fontdatabases/windows/qwindowsfontengine_p.h @@ -67,8 +67,6 @@ class QWindowsFontEngineData; class QWindowsFontEngine : public QFontEngine { Q_DISABLE_COPY(QWindowsFontEngine) - friend class QWindowsMultiFontEngine; - public: QWindowsFontEngine(const QString &name, LOGFONT lf, const QSharedPointer &fontEngineData); @@ -169,14 +167,6 @@ private: mutable int designAdvancesSize = 0; }; -class QWindowsMultiFontEngine : public QFontEngineMulti -{ -public: - explicit QWindowsMultiFontEngine(QFontEngine *fe, int script); - - QFontEngine *loadEngine(int at) override; -}; - QT_END_NAMESPACE Q_DECLARE_METATYPE(HFONT)