summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/minimal/qminimalintegration.cpp
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dedietrich@qt.io>2017-11-29 12:12:05 -0800
committerGabriel de Dietrich <gabriel.dedietrich@qt.io>2017-12-04 22:32:48 +0000
commit8d5842a2d8722322130d0f4e056bcd7be269a2b3 (patch)
treec34f51c6761cb5e6126de0188c5f1b394a3d56a5 /src/plugins/platforms/minimal/qminimalintegration.cpp
parente6aae7df049ab034849c91d944b16f468bf21e40 (diff)
minimal QPA: Make font DB creation more flexible
Prioritize CoreText over Fontconfig since the former is the native one on macOS, and any other native font DB on its respective platform. We introduce a new 'fontconfig' option to allow using Fontconfig instead. This works similarly to 'freetype' overriding the default font engine on Windows. A propos of which, 'freetype' now does the same on macOS. Change-Id: Ic8168820d1d01fddc2f26e046abb65b8ab765f89 Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Diffstat (limited to 'src/plugins/platforms/minimal/qminimalintegration.cpp')
-rw-r--r--src/plugins/platforms/minimal/qminimalintegration.cpp32
1 files changed, 26 insertions, 6 deletions
diff --git a/src/plugins/platforms/minimal/qminimalintegration.cpp b/src/plugins/platforms/minimal/qminimalintegration.cpp
index 9fc7671feb..0c04608fca 100644
--- a/src/plugins/platforms/minimal/qminimalintegration.cpp
+++ b/src/plugins/platforms/minimal/qminimalintegration.cpp
@@ -54,11 +54,17 @@
# endif
#elif defined(Q_OS_DARWIN)
# include <QtFontDatabaseSupport/private/qcoretextfontdatabase_p.h>
-#elif QT_CONFIG(fontconfig)
+#endif
+
+#if QT_CONFIG(fontconfig)
# include <QtFontDatabaseSupport/private/qgenericunixfontdatabase_p.h>
# include <qpa/qplatformfontdatabase.h>
#endif
+#if QT_CONFIG(freetype)
+#include <QtFontDatabaseSupport/private/qfontengine_ft_p.h>
+#endif
+
#if !defined(Q_OS_WIN)
#include <QtEventDispatcherSupport/private/qgenericunixeventdispatcher_p.h>
#elif defined(Q_OS_WINRT)
@@ -81,6 +87,8 @@ static inline unsigned parseOptions(const QStringList &paramList)
options |= QMinimalIntegration::EnableFonts;
else if (param == QLatin1String("freetype"))
options |= QMinimalIntegration::FreeTypeFontDatabase;
+ else if (param == QLatin1String("fontconfig"))
+ options |= QMinimalIntegration::FontconfigDatabase;
}
return options;
}
@@ -129,9 +137,7 @@ public:
QPlatformFontDatabase *QMinimalIntegration::fontDatabase() const
{
if (!m_fontDatabase && (m_options & EnableFonts)) {
-#if QT_CONFIG(fontconfig)
- m_fontDatabase = new QGenericUnixFontDatabase;
-#elif defined(Q_OS_WINRT)
+#if defined(Q_OS_WINRT)
m_fontDatabase = new QWinRTFontDatabase;
#elif defined(Q_OS_WIN)
if (m_options & FreeTypeFontDatabase) {
@@ -142,10 +148,24 @@ QPlatformFontDatabase *QMinimalIntegration::fontDatabase() const
m_fontDatabase = new QWindowsFontDatabase;
}
#elif defined(Q_OS_DARWIN)
- m_fontDatabase = new QCoreTextFontDatabaseEngineFactory<QCoreTextFontEngine>;
+ if (!(m_options & FontconfigDatabase)) {
+ if (m_options & FreeTypeFontDatabase) {
+# if QT_CONFIG(freetype)
+ m_fontDatabase = new QCoreTextFontDatabaseEngineFactory<QFontEngineFT>;
+# endif // freetype
+ } else {
+ m_fontDatabase = new QCoreTextFontDatabaseEngineFactory<QCoreTextFontEngine>;
+ }
+ }
+#endif
+
+ if (!m_fontDatabase) {
+#if QT_CONFIG(fontconfig)
+ m_fontDatabase = new QGenericUnixFontDatabase;
#else
- m_fontDatabase = QPlatformIntegration::fontDatabase();
+ m_fontDatabase = QPlatformIntegration::fontDatabase();
#endif
+ }
}
if (!m_fontDatabase)
m_fontDatabase = new DummyFontDatabase;