Add platform font database support to 'minimal' QPA plugin
This commit extends 060e0f6628fd185994911307 by loading the platform font database if there's any. Note that this happens at compile time and depends on QtFontDatabaseSupport. Change-Id: Id073fd949765d9439bbb3f66187b15de444d535f Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
parent
1103fffb7e
commit
66c2b87547
@ -44,12 +44,19 @@
|
||||
#include <QtGui/private/qguiapplication_p.h>
|
||||
#include <qpa/qplatformwindow.h>
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
#include <QtFontDatabaseSupport/private/qbasicfontdatabase_p.h>
|
||||
#if defined(Q_OS_WINRT)
|
||||
# include <QtFontDatabaseSupport/private/qwinrtfontdatabase_p.h>
|
||||
#elif defined(Q_OS_WIN)
|
||||
# include <QtFontDatabaseSupport/private/qwindowsfontdatabase_p.h>
|
||||
# if QT_CONFIG(freetype)
|
||||
# include <QtFontDatabaseSupport/private/qwindowsfontdatabase_ft_p.h>
|
||||
# endif
|
||||
#elif defined(Q_OS_DARWIN)
|
||||
# include <QtFontDatabaseSupport/private/qcoretextfontdatabase_p.h>
|
||||
#elif QT_CONFIG(fontconfig)
|
||||
#include <QtFontDatabaseSupport/private/qgenericunixfontdatabase_p.h>
|
||||
#else
|
||||
#include <qpa/qplatformfontdatabase.h>
|
||||
# include <QtFontDatabaseSupport/private/qgenericunixfontdatabase_p.h>
|
||||
# include <qpa/qplatformfontdatabase.h>
|
||||
#endif
|
||||
|
||||
#if !defined(Q_OS_WIN)
|
||||
@ -70,6 +77,8 @@ static inline unsigned parseOptions(const QStringList ¶mList)
|
||||
for (const QString ¶m : paramList) {
|
||||
if (param == QLatin1String("enable_fonts"))
|
||||
options |= QMinimalIntegration::EnableFonts;
|
||||
else if (param == QLatin1String("freetype"))
|
||||
options |= QMinimalIntegration::FreeTypeFontDatabase;
|
||||
}
|
||||
return options;
|
||||
}
|
||||
@ -117,12 +126,23 @@ public:
|
||||
|
||||
QPlatformFontDatabase *QMinimalIntegration::fontDatabase() const
|
||||
{
|
||||
if (m_options & EnableFonts) {
|
||||
if (!m_fontDatabase && (m_options & EnableFonts)) {
|
||||
#if QT_CONFIG(fontconfig)
|
||||
if (!m_fontDatabase)
|
||||
m_fontDatabase = new QGenericUnixFontDatabase;
|
||||
m_fontDatabase = new QGenericUnixFontDatabase;
|
||||
#elif defined(Q_OS_WINRT)
|
||||
m_fontDatabase = new QWinRTFontDatabase;
|
||||
#elif defined(Q_OS_WIN)
|
||||
if (m_options & FreeTypeFontDatabase) {
|
||||
# if QT_CONFIG(freetype)
|
||||
m_fontDatabase = new QWindowsFontDatabaseFT;
|
||||
# endif // freetype
|
||||
} else {
|
||||
m_fontDatabase = new QWindowsFontDatabase;
|
||||
}
|
||||
#elif defined(Q_OS_DARWIN)
|
||||
m_fontDatabase = new QCoreTextFontDatabase;
|
||||
#else
|
||||
return QPlatformIntegration::fontDatabase();
|
||||
m_fontDatabase = QPlatformIntegration::fontDatabase();
|
||||
#endif
|
||||
}
|
||||
if (!m_fontDatabase)
|
||||
|
@ -67,7 +67,8 @@ class QMinimalIntegration : public QPlatformIntegration
|
||||
public:
|
||||
enum Options { // Options to be passed on command line or determined from environment
|
||||
DebugBackingStore = 0x1,
|
||||
EnableFonts = 0x2
|
||||
EnableFonts = 0x2,
|
||||
FreeTypeFontDatabase = 0x4
|
||||
};
|
||||
|
||||
explicit QMinimalIntegration(const QStringList ¶meters);
|
||||
|
Loading…
x
Reference in New Issue
Block a user