summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <[email protected]>2025-02-12 13:58:36 +0100
committerEskil Abrahamsen Blomfeldt <[email protected]>2025-02-13 20:15:49 +0100
commitcf674f38450f623d94e5695a221a186c0e551e27 (patch)
treea2710a1336edc6242b6e69f90e61f2a3a0e675d6
parentdd2dc8c70d0227ff235a8c7feaca7d7c4ead9c63 (diff)
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 <[email protected]>
-rw-r--r--src/gui/text/qfontengine_p.h1
-rw-r--r--tests/baseline/painting/scripts/glyphruns.qps2
2 files changed, 2 insertions, 1 deletions
diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h
index 032a8b78126..4d1243ccc51 100644
--- a/src/gui/text/qfontengine_p.h
+++ b/src/gui/text/qfontengine_p.h
@@ -159,6 +159,7 @@ public:
|| ucs4 == QChar::LineFeed
|| ucs4 == QChar::CarriageReturn
|| ucs4 == QChar::ParagraphSeparator
+ || (!disableEmojiSegmenter() && (ucs4 & 0xFFF0) == 0xFE00)
|| QChar::category(ucs4) == QChar::Other_Control;
}
diff --git a/tests/baseline/painting/scripts/glyphruns.qps b/tests/baseline/painting/scripts/glyphruns.qps
index 2b70c72610f..0683ef59ed1 100644
--- a/tests/baseline/painting/scripts/glyphruns.qps
+++ b/tests/baseline/painting/scripts/glyphruns.qps
@@ -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