Treat variation selectors as ignorable chars

The variation selectors only make sense in the context of the
previous glyph and should never be shaped by themselves, therefore
we should not pick a different font engine for these even if
the cmap does not support it. They are sometimes needed to
properly resolve the emojis, but the OpenType rules in the font
may not be written with them in mind.

If the cmap lookup fails for these, then Harfbuzz will map them
to a zero-width space, thus ignoring them when resolving the
OpenType rules.

We treat these the same as other control characters and just
ignore them when doing font merging.

Note: This was handled through an ad hoc mechanism prior to
the introduction of the emoji segmenter in 6.9.When the emoji
segmenter is disabled, we still use this mechanism, which
depends on us not ignoring the character in that case.

Pick-to: 6.9
Fixes: QTBUG-133480
Change-Id: I8fa4e8d5e1aabad0946b8fd3fff044e2b2af5d0e
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
This commit is contained in:
Eskil Abrahamsen Blomfeldt 2025-02-12 13:58:36 +01:00
parent dd2dc8c70d
commit cf674f3845
2 changed files with 2 additions and 1 deletions

View File

@ -159,6 +159,7 @@ public:
|| ucs4 == QChar::LineFeed
|| ucs4 == QChar::CarriageReturn
|| ucs4 == QChar::ParagraphSeparator
|| (!disableEmojiSegmenter() && (ucs4 & 0xFFF0) == 0xFE00)
|| QChar::category(ucs4) == QChar::Other_Control;
}

View File

@ -143,7 +143,7 @@ translate 150 0
save
setPen black
setFont "sansserif" 16 normal
drawGlyphRun 0 40 "e😃m😇o😍j😜i😸!"
drawGlyphRun 0 40 "e😃m👩️‍⚕️o😍j😜i😸!"
restore
translate 0 55