From 7ac3719c37a47d603a3686b566111d761bdc8b5d Mon Sep 17 00:00:00 2001 From: ispyisail Date: Thu, 24 Sep 2026 21:41:00 +1200 Subject: [PATCH] Fix bugtracker #340: map "MS Shell Dlg" aliases on Qt 6/Windows "MS Shell Dlg 2" is a Windows font alias, not a font, and projects and settings saved on Windows carry it. Qt 5's GDI backend let Windows resolve it to Tahoma; Qt 6's DirectWrite backend does not know the alias and falls back to Arial, so those texts render heavier on screen and in exported PDFs. Register the substitutions Windows itself uses, before any application object exists so the headless export and scripting paths get them too. Co-Authored-By: Claude Opus 5.5 --- sources/main.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/sources/main.cpp b/sources/main.cpp index 3c065899f..92cbaf1be 100644 --- a/sources/main.cpp +++ b/sources/main.cpp @@ -33,6 +33,7 @@ #include #include +#include #include #include @@ -107,6 +108,19 @@ int main(int argc, char **argv) // from Qt 6.12 on; opt in explicitly for older Qt 5/6. QDomImplementation::setInvalidDataPolicy( QDomImplementation::ReturnNullNode); + +#ifdef Q_OS_WIN + // "MS Shell Dlg 2" is not a font but a Windows alias, and many projects + // and settings saved on Windows carry it. Qt 5's GDI font backend let + // Windows resolve it to Tahoma; Qt 6's DirectWrite backend does not know + // the alias and falls back to Arial, so those texts come out heavier on + // screen and in exported PDFs (bugtracker #340). Resolve both aliases + // the way Windows does. Done before any application object exists so + // that the headless export and scripting runs below get it too. + QFont::insertSubstitution("MS Shell Dlg 2", "Tahoma"); + QFont::insertSubstitution("MS Shell Dlg", "Microsoft Sans Serif"); +#endif + //Creation and execution of the application //HighDPI qputenv("QT_ENABLE_HIGHDPI_SCALING", "1");