From 25530c7020df099ed26737ee591bf6c55b3d8a39 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 16 Mar 2023 13:28:01 +0100 Subject: [PATCH] win: Fix default fallback font for some languages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In Qt 5, the system font would resolve to MS Shell Dlg 2, which was always an alias for Tahoma. Since it was not a real font, but a so-called "logical font", it was manually added to the font database whenever we detected that the system font was not automatically enumerated. In Qt 6 we modernized the selection of system font. This causes real fonts, such as Segoe UI, to be selected as the default and the manual adding of "MS Shell Dlg 2" to the font database never happens. However, "MS Shell Dlg 2" was still preferred as the primary fallback font, but we now always failed to resolve it because it wasn't in the font database. For many writing systems not supported by the main system font, such as e.g. Thai, people still expect to get Tahoma as the default, but we now return an arbitrary font from the alphabetically ordered list instead. To work around this, we avoid returning the non-existing logical font, since this is no longer useful, and just return Tahoma directly. [ChangeLog][QtGui][Text] Fixed an issue querying a default font for certain languages not supported by the primary system font. Pick-to: 6.2 6.5 Change-Id: Iacc7a7e7742114efcd82620d0ed099dc4e897fc6 Reviewed-by: Friedemann Kleint Reviewed-by: Tor Arne Vestbø --- src/gui/text/windows/qwindowsfontdatabasebase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/text/windows/qwindowsfontdatabasebase.cpp b/src/gui/text/windows/qwindowsfontdatabasebase.cpp index f45678c65c..f9b36b4852 100644 --- a/src/gui/text/windows/qwindowsfontdatabasebase.cpp +++ b/src/gui/text/windows/qwindowsfontdatabasebase.cpp @@ -802,7 +802,7 @@ QString QWindowsFontDatabaseBase::familyForStyleHint(QFont::StyleHint styleHint) default: break; } - return QStringLiteral("MS Shell Dlg 2"); + return QStringLiteral("Tahoma"); } // Creation functions