win: Fix default fallback font for some languages

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 <Friedemann.Kleint@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
bb10
Eskil Abrahamsen Blomfeldt 2023-03-16 13:28:01 +01:00
parent 0685b5b9b0
commit 25530c7020
1 changed files with 1 additions and 1 deletions

View File

@ -802,7 +802,7 @@ QString QWindowsFontDatabaseBase::familyForStyleHint(QFont::StyleHint styleHint)
default:
break;
}
return QStringLiteral("MS Shell Dlg 2");
return QStringLiteral("Tahoma");
}
// Creation functions