fix(emoji): flags render on Windows; "Twitter emoji" works again

Windows' emoji font has no flag glyphs, so 🇺🇸 (:flag_us:) showed as the
letters "US". Two fixes:

- A TwemojiFlags @font-face over the bundled Twemoji file, limited by
  unicode-range to the regional-indicator letters (U+1F1E6–1F1FF), is put in
  the font stack on Windows only. Every other emoji stays native, other
  platforms keep their own flags, and the file is fetched only when a flag is
  on screen.
- The Appearance font setting overwrote --font-secondary with a stack that
  had no emoji families at all, so neither this nor the existing "Twitter
  emoji" switch reached message text. The font map now keeps
  var(--font-flags), var(--font-emoji) before the generic family.

Verified in Chromium via CDP platform fonts: with a Windows user agent 🇺🇸 is
drawn by "Twemoji Mozilla" while 😀 stays on the system emoji font; with a
Linux user agent both stay native.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PPmy3tPq869XDW4njjVaKA
This commit is contained in:
Lotus CI
2026-09-24 22:33:23 -04:00
co-authored by Claude Opus 5.5
parent c0e8334f03
commit b71f9c95c6
3 changed files with 36 additions and 5 deletions
+15 -1
View File
@@ -6,6 +6,19 @@
font-display: swap;
}
/* Country flags only (regional indicator letters U+1F1E6–1F1FF), from the same
Twemoji file. Windows' emoji font has no flag glyphs and draws 🇺🇸 as the
letters "US"; SystemEmojiFeature enables this family on Windows. The
unicode-range means the file is only fetched when a flag is on screen. */
@font-face {
font-family: TwemojiFlags;
src:
url('../public/font/Twemoji.Mozilla.v15.1.0.woff2'),
url('../public/font/Twemoji.Mozilla.v15.1.0.ttf');
unicode-range: U+1F1E6-1F1FF;
font-display: swap;
}
:root {
--tc-link: hsl(213deg 100% 45%);
@@ -28,7 +41,8 @@
--mx-uc-8: hsl(94, 100%, 35%);
--font-emoji: 'Twemoji_DISABLED';
--font-secondary: 'InterVariable', var(--font-emoji), sans-serif;
--font-flags: 'TwemojiFlags_DISABLED';
--font-secondary: 'InterVariable', var(--font-flags), var(--font-emoji), sans-serif;
}
.dark-theme,