qt5base-lts/tests/auto/gui/text
Eskil Abrahamsen Blomfeldt e0ad2cee55 Fix querying font aliases that share name with other fonts
a332f3fabc disabled resolving all fonts
on the system for every font lookup, which was a significant startup
time improvement. But it also caused a regression: When a font has
an alias which shares the name of a proper font, then this would
not be resolved correctly.

This is fairly typical on Windows/GDI due to backwards-compatibility.
Instead of being collected under a shared typographical family, fonts
are disambiguated by adding the style name to the family name. The
proper typographical name is still available, but this is not
enumerated by the system.

So "Segoe UI" for instance, will be available as "Segoe UI",
"Segoe UI Light", "Segoe UI Bold" etc.

When we populate family aliases, we register that "Segoe UI Light"
is actually "Segoe UI" with Light weight, and prior to
a332f3fabc this would be done implicitly.

But after the optimization, we would only populate family aliases once
we stumbled over a font request for a non-existent font. For "Segoe UI",
we would simply return the regular weight font as the best imperfect
match.

The fix is to populate font family aliases not only when the family is
non-existent, but when the match is imperfect, e.g. if we are asking
for a Light weight font and only finding a regular one. User code can
still avoid this somewhat expensive operation by using the full
family names on Windows.

This also requires a fix to a test. When removeApplicationFont() is
called, we invalidate the font database, so it will be reset to a state
that does not contain the family aliases. Therefore we cannot guarantee
that it is identical to what it was before the test started, since this
depends on what has happened previously in the application.

[ChangeLog][QtGui][Text] Fixed an issue where some font styles and weights
would not be selectable. This was especially noticeable on Windows.

Pick-to: 5.15 6.1 6.2
Fixes: QTBUG-94835
Change-Id: I892855edd1c8e3d3734aace396f6000d897d2ec4
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-09-11 11:59:51 +00:00
..
qabstracttextdocumentlayout Remove the qmake project files 2021-01-07 15:32:28 +01:00
qcssparser tests: Use QT_TESTCASE_SOURCEDIR define 2021-08-11 21:03:56 +02:00
qfont BLACKLIST tst_qfont for Red Hat 2021-04-06 07:35:24 +03:00
qfontcache Remove the qmake project files 2021-01-07 15:32:28 +01:00
qfontdatabase Fix querying font aliases that share name with other fonts 2021-09-11 11:59:51 +00:00
qfontmetrics Remove the qmake project files 2021-01-07 15:32:28 +01:00
qglyphrun Fix compiler warning: don't mix signed and unsigned int in comparison 2021-02-11 21:06:00 +01:00
qinputcontrol Remove the qmake project files 2021-01-07 15:32:28 +01:00
qrawfont Fix bug with NoFontMerging when font does not support script 2021-08-19 13:35:40 +02:00
qstatictext Remove QEXPECT_FAIL for tests that pass now on Android 2021-03-31 17:31:12 +02:00
qsyntaxhighlighter Remove the qmake project files 2021-01-07 15:32:28 +01:00
qtextblock Remove the qmake project files 2021-01-07 15:32:28 +01:00
qtextcursor Remove the qmake project files 2021-01-07 15:32:28 +01:00
qtextdocument Remove Qt6 switches from QtGui 2021-05-05 19:26:56 +02:00
qtextdocumentfragment Allow background inheritance between non-body block elements 2021-05-08 09:28:02 +02:00
qtextdocumentlayout Remove the qmake project files 2021-01-07 15:32:28 +01:00
qtextformat Remove the qmake project files 2021-01-07 15:32:28 +01:00
qtextimagehandler Remove the qmake project files 2021-01-07 15:32:28 +01:00
qtextlayout Avoid overflow in text layout 2021-06-17 09:58:27 +00:00
qtextlist Remove the qmake project files 2021-01-07 15:32:28 +01:00
qtextmarkdownimporter tests: Remove unused SRCDIR defines 2021-08-17 12:41:57 +00:00
qtextmarkdownwriter tests: Remove unused SRCDIR defines 2021-08-17 12:41:57 +00:00
qtextobject Remove the qmake project files 2021-01-07 15:32:28 +01:00
qtextodfwriter tests: Remove unused SRCDIR defines 2021-08-17 12:41:57 +00:00
qtextpiecetable Remove the qmake project files 2021-01-07 15:32:28 +01:00
qtextscriptengine Remove the qmake project files 2021-01-07 15:32:28 +01:00
qtexttable tst_qtexttable: fix fail on QEMU ARMv7 2021-02-05 18:36:51 +00:00
qzip Remove the qmake project files 2021-01-07 15:32:28 +01:00
CMakeLists.txt Android: exclude tests crashing at start 2020-11-16 13:35:44 +02:00