summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2019-04-05 11:48:29 +0200
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2020-02-04 10:19:12 +0100
commit35262678c31a4aea0df1516c565cf9a2e808b369 (patch)
treeedb489ea1d6ee09459ec2edcab461c04c3cd7ae4 /src/plugins
parenta13e8d6660913bec172d1374f78083498c539df0 (diff)
Experimental DirectWrite font database
Adds an opt-in experimental DirectWrite-based font database. This cannot be the 100% replacement for GDI unfortunately, since quite a few font formats used on Windows are still unsupported. But it would be good to have it as an opt-in experimental feature since it should make it easier to solve multiple font selection issues we have on Windows. In order to still share the DirectWrite-specific code between the old and new database, this introduces a common base class. Note that the feature depends on DirectWrite 3 support (Windows 10). Fixes: QTBUG-74917 Change-Id: Ida08ec7ef4fda9fc78622ca4297909a727390a64 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/windows/qwindowsintegration.cpp18
-rw-r--r--src/plugins/platforms/windows/qwindowsintegration.h3
2 files changed, 15 insertions, 6 deletions
diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp
index 4b4047ac0c..77340387d8 100644
--- a/src/plugins/platforms/windows/qwindowsintegration.cpp
+++ b/src/plugins/platforms/windows/qwindowsintegration.cpp
@@ -48,6 +48,9 @@
#include "qwindowsscreen.h"
#include "qwindowstheme.h"
#include "qwindowsservices.h"
+#ifdef QT_USE_DIRECTWRITE3
+#include <QtFontDatabaseSupport/private/qwindowsdirectwritefontdatabase_p.h>
+#endif
#ifndef QT_NO_FREETYPE
# include <QtFontDatabaseSupport/private/qwindowsfontdatabase_ft_p.h>
#endif
@@ -187,7 +190,9 @@ static inline unsigned parseOptions(const QStringList &paramList,
unsigned options = 0;
for (const QString &param : paramList) {
if (param.startsWith(u"fontengine=")) {
- if (param.endsWith(u"freetype")) {
+ if (param.endsWith(u"directwrite")) {
+ options |= QWindowsIntegration::FontDatabaseDirectWrite;
+ } else if (param.endsWith(u"freetype")) {
options |= QWindowsIntegration::FontDatabaseFreeType;
} else if (param.endsWith(u"native")) {
options |= QWindowsIntegration::FontDatabaseNative;
@@ -504,14 +509,17 @@ QWindowsStaticOpenGLContext *QWindowsIntegration::staticOpenGLContext()
QPlatformFontDatabase *QWindowsIntegration::fontDatabase() const
{
if (!d->m_fontDatabase) {
-#ifdef QT_NO_FREETYPE
- d->m_fontDatabase = new QWindowsFontDatabase();
-#else // QT_NO_FREETYPE
+#ifdef QT_USE_DIRECTWRITE3
+ if (d->m_options & QWindowsIntegration::FontDatabaseDirectWrite)
+ d->m_fontDatabase = new QWindowsDirectWriteFontDatabase;
+ else
+#endif
+#ifndef QT_NO_FREETYPE
if (d->m_options & QWindowsIntegration::FontDatabaseFreeType)
d->m_fontDatabase = new QWindowsFontDatabaseFT;
else
- d->m_fontDatabase = new QWindowsFontDatabase;
#endif // QT_NO_FREETYPE
+ d->m_fontDatabase = new QWindowsFontDatabase();
}
return d->m_fontDatabase;
}
diff --git a/src/plugins/platforms/windows/qwindowsintegration.h b/src/plugins/platforms/windows/qwindowsintegration.h
index 1f16d13769..165472ad40 100644
--- a/src/plugins/platforms/windows/qwindowsintegration.h
+++ b/src/plugins/platforms/windows/qwindowsintegration.h
@@ -72,7 +72,8 @@ public:
DetectAltGrModifier = 0x800,
RtlEnabled = 0x1000,
DarkModeWindowFrames = 0x2000,
- DarkModeStyle = 0x4000
+ DarkModeStyle = 0x4000,
+ FontDatabaseDirectWrite = 0x8000
};
explicit QWindowsIntegration(const QStringList &paramList);