diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> | 2019-04-05 11:48:29 +0200 |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> | 2020-02-04 10:19:12 +0100 |
commit | 35262678c31a4aea0df1516c565cf9a2e808b369 (patch) | |
tree | edb489ea1d6ee09459ec2edcab461c04c3cd7ae4 /src/plugins/platforms/windows/qwindowsintegration.cpp | |
parent | a13e8d6660913bec172d1374f78083498c539df0 (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/platforms/windows/qwindowsintegration.cpp')
-rw-r--r-- | src/plugins/platforms/windows/qwindowsintegration.cpp | 18 |
1 files changed, 13 insertions, 5 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 ¶mList, unsigned options = 0; for (const QString ¶m : 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; } |