CoreText: prevent colored glyphs (like emoji) to be clipped

To prevent colored glyphs (like emoji) from being cut off at the edges,
we can simply apply the solution from bbba71748438dc05d344bb9727f10b7f55a5d229
to colored glyphs as well (i.e. to glyphs with QFontEngine::Format_ARGB format).

Fixes: QTBUG-133297
Pick-to: 6.9 6.8
Change-Id: I5578e2d12f956d0635b662b3ecf714aa63474945
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
This commit is contained in:
Vladimir Belyavsky 2025-01-28 22:04:40 +03:00 committed by Tor Arne Vestbø
parent d076420bb0
commit 7cc0ea0b5a

View File

@ -591,8 +591,9 @@ glyph_metrics_t QCoreTextFontEngine::alphaMapBoundingBox(glyph_t glyph, const QF
if (br.height < 0)
br.height = -br.height;
if (format == QFontEngine::Format_A8 || format == QFontEngine::Format_A32) {
// Drawing a glyph at x-position 0 with anti-aliasing enabled
if (format == QFontEngine::Format_A8 || format == QFontEngine::Format_A32 || format == QFontEngine::Format_ARGB) {
// Drawing a vector based glyph with anti-aliasing enabled, or a
// bitmap based glyph with pre-baked anti-aliasing, at x = 0,
// will potentially fill the pixel to the left of 0, as the
// coordinates are not aligned to the center of pixels. To
// prevent clipping of this pixel we need to shift the glyph