From f56de5889598c57e0f2fb0b6121b35d9b55f6ce8 Mon Sep 17 00:00:00 2001 From: kleuter Date: Tue, 21 Jan 2025 17:27:49 +0100 Subject: [PATCH] fixed #26 --- .../platforms/windows/qwindowsintegration.cpp | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/qtbase/src/plugins/platforms/windows/qwindowsintegration.cpp b/qtbase/src/plugins/platforms/windows/qwindowsintegration.cpp index 487e1d47..547ca57d 100644 --- a/qtbase/src/plugins/platforms/windows/qwindowsintegration.cpp +++ b/qtbase/src/plugins/platforms/windows/qwindowsintegration.cpp @@ -134,12 +134,42 @@ bool parseIntOption(const QString ¶meter,const QLatin1StringView &option, using DarkModeHandlingFlag = QNativeInterface::Private::QWindowsApplication::DarkModeHandlingFlag; 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, int *tabletAbsoluteRange, QtWindows::DpiAwareness *dpiAwareness, DarkModeHandling *darkModeHandling) { 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) { if (param.startsWith(u"fontengine=")) { if (param.endsWith(u"gdi")) {