From 03f4930ecab95a793601666c1f4a73c207fa1f4d Mon Sep 17 00:00:00 2001 From: Andreas Holzammer Date: Fri, 21 Sep 2012 08:33:57 +0200 Subject: Try to auto-detect the font rendering for WinCE Native font rendering is broken for QML applications, use free type rendering for those scenarios. Use native rendering for all other applications. Use a workaround to find out if we are running a QML application on the target. Related to QTBUG-24205. Change-Id: I653ea579098db1e58af8176cb2c3f943be0b9602 Reviewed-by: Joerg Bornemann --- .../platforms/windows/qwindowsintegration.cpp | 37 +++++++++++++++++++--- src/plugins/platforms/windows/windows.pro | 1 + 2 files changed, 34 insertions(+), 4 deletions(-) (limited to 'src/plugins/platforms/windows') diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp index 59085eed9d..baf306b41a 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.cpp +++ b/src/plugins/platforms/windows/qwindowsintegration.cpp @@ -339,7 +339,8 @@ QPlatformOpenGLContext enum FontDatabaseOption { FontDatabaseFreeType, - FontDatabaseNative + FontDatabaseNative, + FontDatabaseAuto }; static inline FontDatabaseOption fontDatabaseOption(const QObject &nativeInterface) @@ -352,22 +353,50 @@ static inline FontDatabaseOption fontDatabaseOption(const QObject &nativeInterfa if (argument == QLatin1String("native")) return FontDatabaseNative; } - return FontDatabaseNative; + return FontDatabaseAuto; } +#ifdef Q_OS_WINCE +// It's not easy to detect if we are running a QML application +// Let's try to do so by checking if the QtQuick module is loaded. +inline bool isQMLApplication() +{ + // check if the QtQuick library is loaded +#ifdef _DEBUG + HMODULE handle = GetModuleHandle(L"QtQuick" QT_LIBINFIX L"d5.dll"); +#else + HMODULE handle = GetModuleHandle(L"QtQuick" QT_LIBINFIX L"5.dll"); +#endif + return (handle != NULL); +} +#endif + QPlatformFontDatabase *QWindowsIntegration::fontDatabase() const { if (!d->m_fontDatabase) { #ifdef QT_NO_FREETYPE d->m_fontDatabase = new QWindowsFontDatabase(); -#else +#else // QT_NO_FREETYPE FontDatabaseOption option = fontDatabaseOption(d->m_nativeInterface); if (option == FontDatabaseFreeType) { d->m_fontDatabase = new QWindowsFontDatabaseFT; + } else if (option == FontDatabaseNative){ + d->m_fontDatabase = new QWindowsFontDatabase; } else { +#ifndef Q_OS_WINCE d->m_fontDatabase = new QWindowsFontDatabase; - } +#else + if (isQMLApplication()) { + if (QWindowsContext::verboseIntegration) { + qDebug() << "QML application detected, using FreeType rendering"; + } + d->m_fontDatabase = new QWindowsFontDatabaseFT; + } + else + d->m_fontDatabase = new QWindowsFontDatabase; #endif + } +#endif // QT_NO_FREETYPE } return d->m_fontDatabase; } diff --git a/src/plugins/platforms/windows/windows.pro b/src/plugins/platforms/windows/windows.pro index f731b9443a..45379488f7 100644 --- a/src/plugins/platforms/windows/windows.pro +++ b/src/plugins/platforms/windows/windows.pro @@ -18,6 +18,7 @@ win32-g++*: LIBS *= -luuid # For the dialog helpers: !wince*:LIBS *= -lshlwapi -lshell32 !wince*:LIBS *= -ladvapi32 +wince*:DEFINES *= QT_LIBINFIX=L"\"\\\"$${QT_LIBINFIX}\\\"\"" DEFINES *= QT_NO_CAST_FROM_ASCII -- cgit v1.2.3