Fix compilation with -no-directwrite
The refactoring for adding the DirectWrite font database broke disabling this feature, which in turn broke compilation with CMake, since the configure test isn't added there yet. Change-Id: I7727145112df7f1009a09f09bf3368645fb1b5da Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
parent
7b0422d467
commit
15aade6c76
@ -564,6 +564,7 @@ QSharedPointer<QWindowsFontEngineData> QWindowsFontDatabaseBase::data()
|
||||
|
||||
bool QWindowsFontDatabaseBase::init(QSharedPointer<QWindowsFontEngineData> d)
|
||||
{
|
||||
#if !defined(QT_NO_DIRECTWRITE)
|
||||
if (!d->directWriteFactory) {
|
||||
createDirectWriteFactory(&d->directWriteFactory);
|
||||
if (!d->directWriteFactory)
|
||||
@ -576,9 +577,11 @@ bool QWindowsFontDatabaseBase::init(QSharedPointer<QWindowsFontEngineData> d)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
#if !defined(QT_NO_DIRECTWRITE)
|
||||
// ### Qt 6: Link directly to dwrite instead
|
||||
typedef HRESULT (WINAPI *DWriteCreateFactoryType)(DWRITE_FACTORY_TYPE, const IID &, IUnknown **);
|
||||
static inline DWriteCreateFactoryType resolveDWriteCreateFactory()
|
||||
@ -601,14 +604,14 @@ void QWindowsFontDatabaseBase::createDirectWriteFactory(IDWriteFactory **factory
|
||||
return;
|
||||
|
||||
IUnknown *result = nullptr;
|
||||
#if defined(QT_USE_DIRECTWRITE3)
|
||||
# if defined(QT_USE_DIRECTWRITE3)
|
||||
dWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED, __uuidof(IDWriteFactory3), &result);
|
||||
#endif
|
||||
# endif
|
||||
|
||||
#if defined(QT_USE_DIRECTWRITE2)
|
||||
# if defined(QT_USE_DIRECTWRITE2)
|
||||
if (result == nullptr)
|
||||
dWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED, __uuidof(IDWriteFactory2), &result);
|
||||
#endif
|
||||
# endif
|
||||
|
||||
if (result == nullptr) {
|
||||
if (FAILED(dWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED, __uuidof(IDWriteFactory), &result))) {
|
||||
@ -619,6 +622,7 @@ void QWindowsFontDatabaseBase::createDirectWriteFactory(IDWriteFactory **factory
|
||||
|
||||
*factory = static_cast<IDWriteFactory *>(result);
|
||||
}
|
||||
#endif // !defined(QT_NO_DIRECTWRITE)
|
||||
|
||||
int QWindowsFontDatabaseBase::defaultVerticalDPI()
|
||||
{
|
||||
@ -853,7 +857,11 @@ QFontEngine *QWindowsFontDatabaseBase::fontEngine(const QByteArray &fontData, qr
|
||||
fontEngine->fontDef.hintingPreference = hintingPreference;
|
||||
|
||||
directWriteFontFace->Release();
|
||||
#endif // !defined(QT_NO_DIRECTWRITE)
|
||||
#else // !defined(QT_NO_DIRECTWRITE)
|
||||
Q_UNUSED(fontData);
|
||||
Q_UNUSED(pixelSize);
|
||||
Q_UNUSED(hintingPreference);
|
||||
#endif
|
||||
|
||||
return fontEngine;
|
||||
}
|
||||
|
@ -94,7 +94,9 @@ public:
|
||||
|
||||
static int defaultVerticalDPI();
|
||||
static QSharedPointer<QWindowsFontEngineData> data();
|
||||
#if !defined(QT_NO_DIRECTWRITE)
|
||||
static void createDirectWriteFactory(IDWriteFactory **factory);
|
||||
#endif
|
||||
static QFont systemDefaultFont();
|
||||
static HFONT systemFont();
|
||||
static LOGFONT fontDefToLOGFONT(const QFontDef &fontDef, const QString &faceName);
|
||||
|
Loading…
x
Reference in New Issue
Block a user