Emoji character is horizontally misaligned when using COLR font
https://bugs.webkit.org/show_bug.cgi?id=249943
Summary Emoji character is horizontally misaligned when using COLR font
Nolan Lawson
Reported 2022-12-29 09:48:52 PST
Created attachment 464247 [details] Screenshot of Chrome, Firefox, and Safari TP When using the Twemoji Mozilla COLR font [1], Safari Technology Preview Release 160 (Safari 16.4, WebKit 18615.1.14.3) renders certain emoji characters with the wrong alignment inside of a flexbox container with `align-items: center; justify-content: center;`. Minimal repro: https://nolanlawson.github.io/webkit-emoji-font-repro/ Note that the fourth character (☺️) is not horizontally centered, whereas the other characters are. This issue only repros in Safari. In Firefox and Chrome, all emoji characters are rendered with the correct horizontal center alignment. (See attached screenshots.) Based on my testing, this only repros with a custom COLR font (not the built-in Apple Color Emoji font), and only certain emoji characters are misaligned: ☺️, 😐, ♥️, 👍️, etc. [1]: https://github.com/mozilla/twemoji-colr/releases/tag/v0.7.0
Attachments
Screenshot of Chrome, Firefox, and Safari TP (389.77 KB, image/png)
2022-12-29 09:48 PST, Nolan Lawson
no flags
Repro HTML and TTF file (714.38 KB, application/zip)
2022-12-29 09:49 PST, Nolan Lawson
no flags
Nolan Lawson
Comment 1 2022-12-29 09:49:17 PST
Created attachment 464248 [details] Repro HTML and TTF file
zalan
Comment 2 2022-12-29 10:03:58 PST
Thank you for filing this bug report! It looks like the preferred width computation has some issues with fallback fonts. It fails with any flexing type of layout (e.g. shrink to fit) -> .emoji { float: left; font-size: 22px; font-family: MozillaTwemojiColr; border: 1px solid black; }
zalan
Comment 3 2022-12-29 14:07:43 PST
This is about measuring the emoji character. ComplexTextController returns 24px for Apple Color Emoji font, while 44px for MozillaTwemojiColr. When measured using MozillaTwemojiColr, ComplexTextController sees 2 glyphs U+263A and U+FE0F (variant selection) and they advance 22px individually. Myles, do you know what's going on here?
Radar WebKit Bug Importer
Comment 4 2022-12-29 14:08:21 PST
Note You need to log in before you can comment on or make changes to this bug.