diff --git a/src/plugins/platforms/minimal/minimal.pro b/src/plugins/platforms/minimal/minimal.pro index 8cfb68824e..a1a2da547b 100644 --- a/src/plugins/platforms/minimal/minimal.pro +++ b/src/plugins/platforms/minimal/minimal.pro @@ -14,6 +14,8 @@ HEADERS = qminimalintegration.h \ OTHER_FILES += minimal.json +qtConfig(freetype): QMAKE_USE_PRIVATE += freetype + PLUGIN_TYPE = platforms PLUGIN_CLASS_NAME = QMinimalIntegrationPlugin !equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - 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 -#elif QT_CONFIG(fontconfig) +#endif + +#if QT_CONFIG(fontconfig) # include # include #endif +#if QT_CONFIG(freetype) +#include +#endif + #if !defined(Q_OS_WIN) #include #elif defined(Q_OS_WINRT) @@ -81,6 +87,8 @@ static inline unsigned parseOptions(const QStringList ¶mList) 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; -#else - m_fontDatabase = QPlatformIntegration::fontDatabase(); + if (!(m_options & FontconfigDatabase)) { + if (m_options & FreeTypeFontDatabase) { +# if QT_CONFIG(freetype) + m_fontDatabase = new QCoreTextFontDatabaseEngineFactory; +# endif // freetype + } else { + m_fontDatabase = new QCoreTextFontDatabaseEngineFactory; + } + } #endif + + if (!m_fontDatabase) { +#if QT_CONFIG(fontconfig) + m_fontDatabase = new QGenericUnixFontDatabase; +#else + m_fontDatabase = QPlatformIntegration::fontDatabase(); +#endif + } } if (!m_fontDatabase) m_fontDatabase = new DummyFontDatabase; diff --git a/src/plugins/platforms/minimal/qminimalintegration.h b/src/plugins/platforms/minimal/qminimalintegration.h index bc7b23c83c..ad1bec2112 100644 --- a/src/plugins/platforms/minimal/qminimalintegration.h +++ b/src/plugins/platforms/minimal/qminimalintegration.h @@ -68,7 +68,8 @@ public: enum Options { // Options to be passed on command line or determined from environment DebugBackingStore = 0x1, EnableFonts = 0x2, - FreeTypeFontDatabase = 0x4 + FreeTypeFontDatabase = 0x4, + FontconfigDatabase = 0x8 }; explicit QMinimalIntegration(const QStringList ¶meters);