-
Notifications
You must be signed in to change notification settings - Fork 214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Emoji should default to emoji presentation, not text presentation #1104
Comments
Hmm, nope — that goes much too far: Note the giant spaces in the app bar, recipient headers, and message text; and the emoji-styled numbers in the timestamps and even an image filename. Those happen because U+0020 SPACE and U+0030..0039 DIGIT ZERO..DIGIT NINE all have glyphs in the Noto Color Emoji font. In fact it looks like according to the Unicode emoji data files pointed to by TR 51, U+2764 aka That rather seems like a bug in TR 51. Rereading it (in section 4, "Presentation Style") and comparing with that data file |
In principle one solution that would be nice here is to have a font file that's a subset of Noto Color Emoji, containing only the glyphs we actually prefer (so excluding U+0020 SPACE and the digits 0..9 and so on), and put that font first in the list. (Then we'd have a separate font file that is the complementary subset, and when specifically presenting an emoji we'd list both the emoji fonts before the text font.) It looks like there's no legal obstacle to that — the OFL license that Noto Color Emoji comes with (recorded in our tree at The OFL license has an option for the copyright holder to specify a "Reserved Font Name", and then modifying the font might come with an annoying need to rename the font too; but the Noto fonts have no reserved name in general, and in particular the copyright notice in this font file is just "Copyright 2022 Google Inc." — no mention of a reserved name, and that's the place the license prescribes for specifying one. So I spent about an hour today trying to find an appropriate tool to produce that subset. It didn't work out, so I'm abandoning that line of investigation here. In particular I tried:
Probably the next thing I would try is to use the upstream |
Some unicode characters, like U+2764 (❤) or U+00AE (®) can have glyphs in non-Emoji fonts, resulting in incorrect rendering of such characters, where we specifically want an emoji to be displayed. So, explicitly mention "Apple Color Emoji" to be the font used on iOS/macOS for displaying the unicode emoji. This resolves part of zulip#1104, namely for reaction chips and autocomplete results. [greg: wrote test] Fixes-partly: zulip#1104
Some emoji characters in Unicode have a "text presentation" as well as an "emoji presentation". Typically the "text presentation" is black-and-white and around the same size as letter glyphs, while the "emoji presentation" is colorful and larger.
For example, ❤ U+2764 HEAVY BLACK HEART can appear either as ❤︎ (the text presentation) or ❤️ (the emoji presentation).
On choosing between the two, the Unicode spec (in TR 51) says:
So for Zulip we should prefer the colorful emoji presentation. Currently we favor the text presentation instead, for those emoji that have both. For example, this message reads
:heart:
in Markdown, and on the web it looks like so:But in this app it currently looks like so:
(In zulip-mobile it looks… blank. I don't have a diagnosis for that.)
The symptom was originally spotted by @rajveermalviya, at 3efe038 / 3efe038 (in the draft #1103).
This issue doesn't affect most emoji — newer emoji, including those added in the emoji boom, have only emoji presentations. Probably U+2764, aka
:heart:
in Zulip, is the most conspicuous example.Implementation
One way to control the presentation can be to follow the emoji with the code point U+FE0F VARIATION SELECTOR-16 to request emoji presentation, or U+FE0E VARIATION SELECTOR-15 for text presentation. (That's what I did at the top of this issue description, to get the two different presentations here in GitHub.) It'd be messy to try to do that globally everywhere emoji appear, though.
Happily I think we can control it instead by the ordering of font choices: just make sure the emoji font comes first. An emoji with both kinds of presentation will have glyphs in both the emoji font and a plain-text font, and what we want is to select the emoji font's glyph.
Scope
This issue covers only where we explicitly know we're working with an emoji:
UnicodeEmojiNode
in message content, corresponding to aspan.emoji
element in the HTML;(For reaction chips and autocomplete results we already get this right on Android, and the issue only affects iOS. See our
UnicodeEmojiWidget
, and the changes there in #1108.)Out of scope for this issue is when a literal emoji character appears as part of some user-generated text:
TextNode
in message content, corresponding to a text element in the HTML. As far as I know there's no longer a way to generate a message with emoji in a text node, though there used to be — compare this test message yesterday, where the only emoji is in an emoji span, to the message from 2020 it's quoting, where the same Markdown source produced some literal emoji following an emoji span.Those are out of scope because they're harder — see the comments below — and also are much less common. I'll file a separate follow-up issue for them.
The text was updated successfully, but these errors were encountered: