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 <joerg.bornemann@digia.com>
This commit is contained in:
Andreas Holzammer 2012-09-21 08:33:57 +02:00 committed by The Qt Project
parent d16efdfc0e
commit 03f4930eca
2 changed files with 35 additions and 5 deletions

View File

@ -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 {
} 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;
}

View File

@ -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