qt6-bb10/src/gui
Eskil Abrahamsen Blomfeldt 43a63901f4 Fix bug with NoFontMerging when font does not support script
When using NoFontMerging, no fallbacks should be resolved. If the
font does not support a specific character in the text, we should
display a box instead of merging it with another font.

But in practice, Qt would still apply the fallback mechanism for
one specific case: If the font itself does not support the script
of the text, we would get no match and do a search for a fallback
instead. Since NoFontMerging is set, we would then force this
as preresolved for *all* scripts in the QFont's private data
(logically, the match should only have a single response for
NoFontMerging).

The end result was that if you set the font family before updating
the text, you would get broken rendering. This can happen e.g. in
Qt Quick, where you could update the font family of a text label
while it contains characters which are not supported by the new
font. Qt would then pick a fallback instead. When you subsequently
update the text, the fallback would already be preresolved for
whatever script this is. If it does not support the updated text,
we would then see boxes, even if the requested font actually would
have supported it.

The fix is simply to do an additional pass if NoFontMerging is set
and we were not able to match with the specified script. Since
the same family might be available in different foundries, with
different writing system support, we still want to do a pass first
to see if we can match the exact script of the text.

Note that QRawFont::fromFont() exploited the bug by using
NoFontMerging for getting the fallback font for a specific
writing system. To keep this working without having to rewrite
fromFont() and risk introducing regressions, we add an argument
to make the findFont() function behave as before. It isn't
super-pretty, but since it is private API it is hopefully fine.

[ChangeLog][QtGui][Text] Fixed an issue with NoFontMerging and
changing font families dynamically, where boxes would be seen in
place of the correct text.

Pick-to: 5.15 6.1 6.2
Done-with: Andy Shaw
Fixes: QTBUG-81770
Change-Id: Ide9a36d7528a1040172c5864fa99e7a82eac4e83
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-08-19 13:35:40 +02:00
..
accessible gui: accessible - silence int conversion warning 2021-06-17 22:55:18 +08:00
animation Remove the qmake project files 2021-01-07 15:32:28 +01:00
doc QMenu/QToolBar: remove addAction() functions 2021-07-13 19:58:08 +02:00
image qpnghandler: Only assume we're past the input size if it returns a size 2021-08-19 02:27:28 +02:00
itemmodels QFileSystemModel: cache the name filters regexps 2021-08-04 14:03:21 +02:00
kernel QFileDialog: Use static const QRegularExpression 2021-08-18 08:50:54 +05:00
math3d Doc: Ensure deprecated APIs in Gui are documented as such 2021-07-26 12:37:12 +02:00
opengl Support EGL protected content extension 2021-03-09 11:58:12 +01:00
painting Refix for avoiding huge number of tiny dashes 2021-08-10 12:00:13 +02:00
platform Change since for QNativeInterface::QX11Application to 6.2 2021-08-17 04:23:48 +02:00
rhi rhi: metal: Make base vertex and instance support optional 2021-08-18 22:15:35 +02:00
text Fix bug with NoFontMerging when font does not support script 2021-08-19 13:35:40 +02:00
util Correct examples for int validation in QValidator documentation 2021-06-08 21:10:11 +00:00
vulkan codechecker: Add assert for implicit condition 2021-06-18 10:37:17 +02:00
CMakeLists.txt Add native interface for X11 application, exposing display and connection 2021-08-06 15:09:39 +02:00
QtGui.dynlist
configure.cmake Add native interface for X11 application, exposing display and connection 2021-08-06 15:09:39 +02:00
qt_cmdline.cmake Remove the deprecated -qpa-platform-guard argument 2020-08-23 11:05:14 +02:00
qtgui.tracepoints Fix compilation error when LTTng enabled 2021-03-25 15:37:55 +09:00