summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@nokia.com>2012-04-12 16:30:23 +0200
committerQt by Nokia <qt-info@nokia.com>2012-04-13 18:15:26 +0200
commit13ebff81d034579c3686aa1e1f6aa1f8a0dfcb93 (patch)
treea9287dd0c6c23273e1a7fc4bcf08eefdfee88bd4 /src/plugins/platforms/windows
parentcdc221ae00260c1bea196e2728eb20b83db19bbe (diff)
Windows: Determine suitable font engine from application.
The Freetype engine currently works better for QML2, whereas the native engine is better suited to the widgets. Task-number: QTBUG-24205 Change-Id: I76de98c3e7c84a2d72542ea9860b8be1e67f7e04 Reviewed-by: Jan-Arve Sæther <jan-arve.saether@nokia.com>
Diffstat (limited to 'src/plugins/platforms/windows')
-rw-r--r--src/plugins/platforms/windows/qwindowsintegration.cpp41
1 files changed, 34 insertions, 7 deletions
diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp
index 6da8932164..d8d04fc1b6 100644
--- a/src/plugins/platforms/windows/qwindowsintegration.cpp
+++ b/src/plugins/platforms/windows/qwindowsintegration.cpp
@@ -277,17 +277,44 @@ QPlatformOpenGLContext
return 0;
}
+/* Workaround for QTBUG-24205: In 'Auto', pick the FreeType engine for
+ * QML2 applications. */
+
+enum FontDatabaseOption {
+ FontDatabaseAuto,
+ FontDatabaseFreeType,
+ FontDatabaseNative
+};
+
+static inline FontDatabaseOption fontDatabaseOption(const QObject &nativeInterface)
+{
+ const QVariant argumentV = nativeInterface.property("fontengine");
+ if (argumentV.isValid()) {
+ const QString argument = argumentV.toString();
+ if (argument == QLatin1String("freetype"))
+ return FontDatabaseFreeType;
+ if (argument == QLatin1String("native"))
+ return FontDatabaseNative;
+ }
+ return FontDatabaseAuto;
+}
+
QPlatformFontDatabase *QWindowsIntegration::fontDatabase() const
{
if (!d->m_fontDatabase) {
-#ifndef QT_NO_FREETYPE
- const QVariant argument = d->m_nativeInterface.property("fontengine");
- if (argument.isValid() && argument.toString() == QLatin1String("freetype"))
- d->m_fontDatabase = new QWindowsFontDatabaseFT();
- else
- d->m_fontDatabase = new QWindowsFontDatabase();
-#else
+#ifdef QT_NO_FREETYPE
d->m_fontDatabase = new QWindowsFontDatabase();
+#else
+ FontDatabaseOption option = fontDatabaseOption(d->m_nativeInterface);
+ if (option == FontDatabaseAuto) {
+ option = QCoreApplication::applicationName() == QStringLiteral("QtQmlViewer") ?
+ FontDatabaseFreeType : FontDatabaseNative;
+ }
+ if (option == FontDatabaseFreeType) {
+ d->m_fontDatabase = new QWindowsFontDatabaseFT;
+ } else {
+ d->m_fontDatabase = new QWindowsFontDatabase;
+ }
#endif
}
return d->m_fontDatabase;