Offscreen QPA: use a CoreText font database on macOS

Without this applications using the Offscreen QPA don't have
access to any fonts on macOS and thus cannot render text correctly.

Task-number: QTBUG-72335
Change-Id: I8e58c066365d0231d0993ad3b480d957a32f7f7b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
R.J.V. Bertin 2018-12-05 18:47:47 +01:00 committed by René J.V. Bertin
parent 9fbce8d5cb
commit 6b52c1834d

View File

@ -45,6 +45,7 @@
#include <QtEventDispatcherSupport/private/qgenericunixeventdispatcher_p.h> #include <QtEventDispatcherSupport/private/qgenericunixeventdispatcher_p.h>
#if defined(Q_OS_MAC) #if defined(Q_OS_MAC)
#include <qpa/qplatformfontdatabase.h> #include <qpa/qplatformfontdatabase.h>
#include <QtFontDatabaseSupport/private/qcoretextfontdatabase_p.h>
#else #else
#include <QtFontDatabaseSupport/private/qgenericunixfontdatabase_p.h> #include <QtFontDatabaseSupport/private/qgenericunixfontdatabase_p.h>
#endif #endif
@ -67,6 +68,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QCoreTextFontEngine;
template <typename BaseEventDispatcher> template <typename BaseEventDispatcher>
class QOffscreenEventDispatcher : public BaseEventDispatcher class QOffscreenEventDispatcher : public BaseEventDispatcher
{ {
@ -101,7 +104,7 @@ QOffscreenIntegration::QOffscreenIntegration()
{ {
#if defined(Q_OS_UNIX) #if defined(Q_OS_UNIX)
#if defined(Q_OS_MAC) #if defined(Q_OS_MAC)
m_fontDatabase.reset(new QPlatformFontDatabase()); m_fontDatabase.reset(new QCoreTextFontDatabaseEngineFactory<QCoreTextFontEngine>);
#else #else
m_fontDatabase.reset(new QGenericUnixFontDatabase()); m_fontDatabase.reset(new QGenericUnixFontDatabase());
#endif #endif