Generate the Twemoji colour font, build Emoji.asset and route TMP's emoji fallback to it

Assets/Fonts/Emoji/Twemoji.ttf is fetch_emoji_font.py's output for jdecked/twemoji
v17.0.3 (nanoemoji 0.16.0, glyf_colr_0), reproduced bit-identically by two
independent runs on Yggdrasil; the lock pins source and font sha256. EmojiFont.Build
wrote Emoji.asset (dynamic, COLOR, multi-atlas) and TMP Settings' emoji fallback list,
global fallback entry and empty default sprite asset. EmojiCheck.Run: 1425 single
code points and the eight Pirates names render with no missing code point. CC BY 4.0
attribution ships in Assets/Fonts/Emoji/LICENSE.txt. Builds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-08 19:34:49 +02:00
commit 1c549325f9
13 changed files with 1915 additions and 4 deletions

View file

@ -90,8 +90,11 @@ public static class EmojiCheck
foreach (var cp in missing.OrderBy(c => c)) failures.Add($"missing code point U+{cp:X4}");
long ink = 0, colour = 0;
int pages = 0, nullPages = 0;
foreach (var page in emoji.atlasTextures)
{
if (page == null) { nullPages++; continue; }
pages++;
var pixels = page.GetPixels32();
ink += pixels.LongCount(p => p.a != 0);
colour += pixels.LongCount(p => p.a != 0 && (p.r != p.g || p.g != p.b));
@ -102,7 +105,7 @@ public static class EmojiCheck
// Dynamic atlas content is cache: drop it so this check leaves the asset as Build wrote it.
emoji.ClearFontAssetData(true);
return $"checked {corpus.Count} single code points + {PiratesNames.Length} Pirates names, {missing.Count} missing, " +
$"{viaEmoji} glyphs via the emoji asset, {viaOther} via other fonts, {blank} blank, {ink} atlas ink pixels of which {colour} coloured";
$"{viaEmoji} glyphs via the emoji asset, {viaOther} via other fonts, {blank} blank, {ink} atlas ink pixels of which {colour} coloured, {pages} atlas pages ({nullPages} null)";
}
static List<int> LoadSingles()

View file

@ -57,7 +57,9 @@ public static class EmojiFont
asset.material.name = "Emoji Atlas Material";
AssetDatabase.AddObjectToAsset(asset.material, asset);
}
else asset.ClearFontAssetData(true);
// The atlas pages are cache: Build leaves them empty, the same state EmojiCheck restores.
asset.ClearFontAssetData(true);
// Text-presentation emoji (U+263A without FE0F) are not routed through the emoji list, so the
// asset is also the global fallback.