summaryrefslogtreecommitdiffstats
path: root/src/platformsupport
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2020-02-10 13:32:36 +0100
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2020-02-10 23:03:51 +0100
commit15aade6c765e4b4b2548c7487408f73ff2d76c03 (patch)
treedb376ee13348d7fd950c4edfdbd909287154af07 /src/platformsupport
parent7b0422d46760fec268a89139aceafe37b1a946d9 (diff)
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>
Diffstat (limited to 'src/platformsupport')
-rw-r--r--src/platformsupport/fontdatabases/windows/qwindowsfontdatabasebase.cpp18
-rw-r--r--src/platformsupport/fontdatabases/windows/qwindowsfontdatabasebase_p.h2
2 files changed, 15 insertions, 5 deletions
diff --git a/src/platformsupport/fontdatabases/windows/qwindowsfontdatabasebase.cpp b/src/platformsupport/fontdatabases/windows/qwindowsfontdatabasebase.cpp
index ff46866cb0..5b8707cdec 100644
--- a/src/platformsupport/fontdatabases/windows/qwindowsfontdatabasebase.cpp
+++ b/src/platformsupport/fontdatabases/windows/qwindowsfontdatabasebase.cpp
@@ -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;
}
diff --git a/src/platformsupport/fontdatabases/windows/qwindowsfontdatabasebase_p.h b/src/platformsupport/fontdatabases/windows/qwindowsfontdatabasebase_p.h
index 004889ab86..fbaa98b663 100644
--- a/src/platformsupport/fontdatabases/windows/qwindowsfontdatabasebase_p.h
+++ b/src/platformsupport/fontdatabases/windows/qwindowsfontdatabasebase_p.h
@@ -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);