Skip to content

Emoji should default to emoji presentation, not text presentation #1104

Closed
@gnprice

Description

@gnprice

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:

In informal environments like texting and chats, it is more appropriate for most emoji characters to appear with a colorful emoji presentation, and only get a text presentation with a text presentation selector. Conversely, in formal environments such as word processing, it is generally better for emoji characters to appear with a text presentation, and only get the colorful emoji presentation with the emoji presentation selector.

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:
image
But in this app it currently looks like so:
image
(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 a span.emoji element in the HTML;
  • emoji reaction chips;
  • emoji autocomplete results;
  • and I think that's currently it.

(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.
  • Topics, channel names, users' names, organization names, and other places where more-or-less-arbitrary plain text appears.

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.

Metadata

Metadata

Assignees

Labels

a-contentParsing and rendering Zulip HTML content, notably message contents

Type

No type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions