mirror of
https://github.com/crystalidea/qt6windows7.git
synced 2025-04-01 22:08:37 +08:00
turn off directwrite fonts on Windows prior to Windows 10 (issue https://github.com/crystalidea/qt6windows7/issues/33)
This commit is contained in:
parent
e92ba4dce4
commit
15d5fb5382
@ -134,29 +134,6 @@ bool parseIntOption(const QString ¶meter,const QLatin1StringView &option,
|
|||||||
using DarkModeHandlingFlag = QNativeInterface::Private::QWindowsApplication::DarkModeHandlingFlag;
|
using DarkModeHandlingFlag = QNativeInterface::Private::QWindowsApplication::DarkModeHandlingFlag;
|
||||||
using DarkModeHandling = QNativeInterface::Private::QWindowsApplication::DarkModeHandling;
|
using DarkModeHandling = QNativeInterface::Private::QWindowsApplication::DarkModeHandling;
|
||||||
|
|
||||||
typedef LONG (WINAPI *RtlGetVersionPtr)(PRTL_OSVERSIONINFOW);
|
|
||||||
|
|
||||||
bool isWindows81() {
|
|
||||||
HMODULE hNtdll = GetModuleHandleA("ntdll.dll");
|
|
||||||
if (!hNtdll) {
|
|
||||||
return false; // Failed to load ntdll.dll
|
|
||||||
}
|
|
||||||
|
|
||||||
RtlGetVersionPtr RtlGetVersion = (RtlGetVersionPtr)GetProcAddress(hNtdll, "RtlGetVersion");
|
|
||||||
if (!RtlGetVersion) {
|
|
||||||
return false; // Failed to get RtlGetVersion
|
|
||||||
}
|
|
||||||
|
|
||||||
RTL_OSVERSIONINFOW rovi = {0};
|
|
||||||
rovi.dwOSVersionInfoSize = sizeof(rovi);
|
|
||||||
|
|
||||||
if (RtlGetVersion(&rovi) == 0) { // STATUS_SUCCESS
|
|
||||||
return (rovi.dwMajorVersion == 6 && rovi.dwMinorVersion == 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false; // Unknown version
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline unsigned parseOptions(const QStringList ¶mList,
|
static inline unsigned parseOptions(const QStringList ¶mList,
|
||||||
int *tabletAbsoluteRange,
|
int *tabletAbsoluteRange,
|
||||||
QtWindows::DpiAwareness *dpiAwareness,
|
QtWindows::DpiAwareness *dpiAwareness,
|
||||||
@ -164,12 +141,6 @@ static inline unsigned parseOptions(const QStringList ¶mList,
|
|||||||
{
|
{
|
||||||
unsigned options = 0;
|
unsigned options = 0;
|
||||||
|
|
||||||
// for some reason DirectWrite fonts don't work on Windows 8.1
|
|
||||||
// https://github.com/crystalidea/qt6windows7/issues/26
|
|
||||||
|
|
||||||
if (isWindows81())
|
|
||||||
options |= QWindowsIntegration::DontUseDirectWriteFonts;
|
|
||||||
|
|
||||||
for (const QString ¶m : paramList) {
|
for (const QString ¶m : paramList) {
|
||||||
if (param.startsWith(u"fontengine=")) {
|
if (param.startsWith(u"fontengine=")) {
|
||||||
if (param.endsWith(u"gdi")) {
|
if (param.endsWith(u"gdi")) {
|
||||||
@ -515,7 +486,14 @@ QPlatformFontDatabase *QWindowsIntegration::fontDatabase() const
|
|||||||
else
|
else
|
||||||
#endif // QT_NO_FREETYPE
|
#endif // QT_NO_FREETYPE
|
||||||
#if QT_CONFIG(directwrite3)
|
#if QT_CONFIG(directwrite3)
|
||||||
if (!(d->m_options & (QWindowsIntegration::FontDatabaseGDI | QWindowsIntegration::DontUseDirectWriteFonts)))
|
|
||||||
|
/* IDWriteFontFace3 is only reportedly available starting with Windows 10. This change is necessary starting
|
||||||
|
with Qt 6.8, where DirectWrite is used by default to populate the font database.
|
||||||
|
More info: https://github.com/videolan/vlc/blob/master/contrib/src/qt/0001-Use-DirectWrite-font-database-only-with-Windows-10-a.patch
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (QOperatingSystemVersion::current() >= QOperatingSystemVersion::Windows10 &&
|
||||||
|
!(d->m_options & (QWindowsIntegration::FontDatabaseGDI | QWindowsIntegration::DontUseDirectWriteFonts)))
|
||||||
d->m_fontDatabase = new QWindowsDirectWriteFontDatabase;
|
d->m_fontDatabase = new QWindowsDirectWriteFontDatabase;
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user