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:
parent
d16efdfc0e
commit
03f4930eca
@ -339,7 +339,8 @@ QPlatformOpenGLContext
|
|||||||
|
|
||||||
enum FontDatabaseOption {
|
enum FontDatabaseOption {
|
||||||
FontDatabaseFreeType,
|
FontDatabaseFreeType,
|
||||||
FontDatabaseNative
|
FontDatabaseNative,
|
||||||
|
FontDatabaseAuto
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline FontDatabaseOption fontDatabaseOption(const QObject &nativeInterface)
|
static inline FontDatabaseOption fontDatabaseOption(const QObject &nativeInterface)
|
||||||
@ -352,22 +353,50 @@ static inline FontDatabaseOption fontDatabaseOption(const QObject &nativeInterfa
|
|||||||
if (argument == QLatin1String("native"))
|
if (argument == QLatin1String("native"))
|
||||||
return FontDatabaseNative;
|
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
|
QPlatformFontDatabase *QWindowsIntegration::fontDatabase() const
|
||||||
{
|
{
|
||||||
if (!d->m_fontDatabase) {
|
if (!d->m_fontDatabase) {
|
||||||
#ifdef QT_NO_FREETYPE
|
#ifdef QT_NO_FREETYPE
|
||||||
d->m_fontDatabase = new QWindowsFontDatabase();
|
d->m_fontDatabase = new QWindowsFontDatabase();
|
||||||
#else
|
#else // QT_NO_FREETYPE
|
||||||
FontDatabaseOption option = fontDatabaseOption(d->m_nativeInterface);
|
FontDatabaseOption option = fontDatabaseOption(d->m_nativeInterface);
|
||||||
if (option == FontDatabaseFreeType) {
|
if (option == FontDatabaseFreeType) {
|
||||||
d->m_fontDatabase = new QWindowsFontDatabaseFT;
|
d->m_fontDatabase = new QWindowsFontDatabaseFT;
|
||||||
} else {
|
} else if (option == FontDatabaseNative){
|
||||||
d->m_fontDatabase = new QWindowsFontDatabase;
|
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
|
||||||
|
}
|
||||||
|
#endif // QT_NO_FREETYPE
|
||||||
}
|
}
|
||||||
return d->m_fontDatabase;
|
return d->m_fontDatabase;
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@ win32-g++*: LIBS *= -luuid
|
|||||||
# For the dialog helpers:
|
# For the dialog helpers:
|
||||||
!wince*:LIBS *= -lshlwapi -lshell32
|
!wince*:LIBS *= -lshlwapi -lshell32
|
||||||
!wince*:LIBS *= -ladvapi32
|
!wince*:LIBS *= -ladvapi32
|
||||||
|
wince*:DEFINES *= QT_LIBINFIX=L"\"\\\"$${QT_LIBINFIX}\\\"\""
|
||||||
|
|
||||||
DEFINES *= QT_NO_CAST_FROM_ASCII
|
DEFINES *= QT_NO_CAST_FROM_ASCII
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user