From cb2633468413d8c2a9e28d4c4a10b25e90dd3116 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 25 Nov 2024 16:05:09 +0100 Subject: Skip ad hoc handling of variation selector in font merging Since we now support emoji parsing, there is no longer any need for this ad hoc processing of VS-16. The exception is if Qt is built without the emoji segmenter, in which case we should keep it for consistency with previous versions. Task-number: QTBUG-111801 Change-Id: I3e243b9610fe55dda26eba63ac849e6afa22a185 Reviewed-by: Volker Hilsheimer diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index 02595b40c5..6be6a5aca2 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -1997,8 +1997,11 @@ int QFontEngineMulti::stringToCMap(const QChar *str, int len, int glyph_pos = 0; QStringIterator it(str, str + len); - int lastFallback = -1; +#if defined(QT_NO_EMOJISEGMENTER) char32_t previousUcs4 = 0; +#endif + + int lastFallback = -1; while (it.hasNext()) { const char32_t ucs4 = it.peekNext(); @@ -2057,6 +2060,7 @@ int QFontEngineMulti::stringToCMap(const QChar *str, int len, } } +#if defined(QT_NO_EMOJISEGMENTER) // For variant-selectors, they are modifiers to the previous character. If we // end up with different font selections for the selector and the character it // modifies, we try applying the selector font to the preceding character as well @@ -2095,11 +2099,15 @@ int QFontEngineMulti::stringToCMap(const QChar *str, int len, } } } +#endif } it.advance(); ++glyph_pos; + +#if defined(QT_NO_EMOJISEGMENTER) previousUcs4 = ucs4; +#endif } *nglyphs = glyph_pos;