Skip to content
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

fix: newer emoji and flags on Firefox on Windows #271

Merged
merged 2 commits into from
Mar 20, 2022
Merged

Conversation

nolanlawson
Copy link
Owner

@nolanlawson nolanlawson commented Mar 20, 2022

Previous discussion: #268 (comment)

On Windows and Linux (but apparently not MacOS or Android), Firefox ships its own "Twemoji Mozilla" font. On Windows in particular, the conflicts with the existing Segoe UI font, causing several issues:

  • Older emoji render in Segoe, newer emoji render in Twemoji
  • Transgender flag renders as double emoji
  • England, Scotland, and Wales flags render as black flags

This PR changes the order of fonts in the font-family list to put "Twemoji Mozilla" first. I'm just going to assume that, if Mozilla is bundling their own font in the browser, then they know what they're doing and they're shipping emoji updates faster than the underlying OS.

This assumption will break if the underlying OS emoji (i.e. Noto Emoji on Linux and Segoe UI on Windows) ever update faster than Mozilla Twemoji, but I guess we have to take that risk. Today Mozilla Twemoji is on v13.1, Segoe is on v12.1 (on my Windows 10 21H2), and Noto is on v13.1 (on my Ubuntu 20.04).

Before:

Screenshot 2022-03-20 135322
Screenshot 2022-03-20 134437
Screenshot 2022-03-20 134457

After:

Screenshot 2022-03-20 140544
Screenshot 2022-03-20 140556
Screenshot 2022-03-20 140605

MacOS and Android are unchanged because Mozilla doesn't ship Twemoji there. Linux is unchanged because we already listed Twemoji before Noto.

@github-actions
Copy link

github-actions bot commented Mar 20, 2022

📊 Tachometer Benchmark Results

Summary

benchmark-total

  • emoji-picker-element-database-interactions: unsure 🔍 -5% - +3% (-8.56ms - +5.38ms)
    this-change vs tip-of-tree
  • emoji-picker-element-first-load: unsure 🔍 -8% - +7% (-6.77ms - +6.38ms)
    this-change vs tip-of-tree
  • emoji-picker-element-second-load: unsure 🔍 -3% - +10% (-2.10ms - +8.05ms)
    this-change vs tip-of-tree

Results

emoji-picker-element-database-interactions
VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
this-change
157.18ms - 167.00ms-unsure 🔍
-5% - +3%
-8.56ms - +5.38ms
tip-of-tree
tip-of-tree
158.74ms - 168.62msunsure 🔍
-3% - +5%
-5.38ms - +8.56ms
-
emoji-picker-element-first-load
VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
this-change
83.12ms - 92.45ms-unsure 🔍
-8% - +7%
-6.77ms - +6.38ms
tip-of-tree
tip-of-tree
83.35ms - 92.61msunsure 🔍
-7% - +8%
-6.38ms - +6.77ms
-
emoji-picker-element-second-load
VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
this-change
83.29ms - 90.44ms-unsure 🔍
-3% - +10%
-2.10ms - +8.05ms
tip-of-tree
tip-of-tree
80.29ms - 87.50msunsure 🔍
-9% - +2%
-8.05ms - +2.10ms
-

tachometer-reporter-action v2 for Benchmarks

@github-actions
Copy link

Size Change: 0 B

Total Size: 41.8 kB

ℹ️ View Unchanged
Filename Size
./bundle.js 41.8 kB

compressed-size-action

@nolanlawson nolanlawson changed the title fix: emoji v14 and flags on Firefox on Windows fix: newer emoji and flags on Firefox on Windows Mar 20, 2022
@eteeselink
Copy link
Contributor

At the risk of chipping in unsolicited: I'm not 100% convinced that this is the right solution, because the user tends to pick an emoji into something - likely a text field of sorts, and it'll be a quirky experience for the emoji picker to show Twemojis everywhere, but then when an emoji is picked, it'll show in the Segoe UI style again which looks quite different, to the point that I can imagine some users think they picked the wrong emoji. I guess the workaround is for every app that uses emoji-picker-element to also add Twemoji Mozilla to their font lists everywhere emojis could be shown, but it's still a bit surprising.

That, or I'm missing something :-)

@nolanlawson
Copy link
Owner Author

@eteeselink No problem with unsolicited feedback. 🙂

Yeah, it's a bit unfortunate, but the best way to ensure that your app renders exactly the same as emoji-picker-element is to copy over its font-family. This is what I do in my own app, Pinafore.

An alternative you might imagine is to just not specify the font-family at all! Unfortunately this results in worse behavior: some early emoji (like "smiling face" and "heart") render as black-and-white on some browsers. E.g. here is Chrome on Windows and Chrome on Ubuntu:

Screenshot 2022-03-20 143952

Screenshot from 2022-03-20 14-40-50

Also, that causes Firefox on Windows to still do the mixed font behavior:

Screenshot 2022-03-20 144033

I should really document this, though, since it's not at all obvious.

@nolanlawson
Copy link
Owner Author

nolanlawson commented Mar 20, 2022

In related news, it looks like Noto has released v14 whereas Mozilla Twemoji hasn't yet updated to v14 (mozilla/twemoji-colr#64). So possibly some Linux users are going to get a mix of Twemoji and Noto.

I'd still prefer putting Twemoji first, though, because I don't want to play a cat-and-mouse game of updating the list of fonts every time a browser or OS does a release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants