From aebf12e195cbf15075054b089711924ee6398b0e Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Mon, 12 Oct 2026 04:50:31 +0200 Subject: [PATCH] Emoji routes: Emoji.asset named in TMP's emoji fallback list as well as the global list (ruling emoji-fallback-route); EmojiCheck asserts both routes and prints the font serving each piece of a failing sequence Keycaps and the other body-font-based sequences now collapse: 25 failures become 13. The 13 FE0F+ZWJ sequences still show three pieces. Builds. Co-Authored-By: Claude Opus 5.5 --- Assets/Scripts/Editor/EmojiCheck.cs | 24 ++++++++++++------- Assets/Scripts/Editor/EmojiFont.cs | 16 +++++++------ .../TextMesh Pro/Resources/TMP Settings.asset | 4 ++-- 3 files changed, 26 insertions(+), 18 deletions(-) diff --git a/Assets/Scripts/Editor/EmojiCheck.cs b/Assets/Scripts/Editor/EmojiCheck.cs index fb79dbd1d..1f464fd9f 100644 --- a/Assets/Scripts/Editor/EmojiCheck.cs +++ b/Assets/Scripts/Editor/EmojiCheck.cs @@ -9,8 +9,9 @@ using UnityEngine; // Every single-code-point emoji of the pinned Unicode Emoji version that Twemoji draws, and the Pirates product // names read from the shipped catalog, render through an ordinary TMP text on the game's body font with no // missing code point, no blank glyph, ink in the emoji atlas, and each glyph served by the emoji asset or by the -// body font itself, never by a third font. TMP Settings must route emoji by exactly one entry: the global -// fallback (the emoji fallback list stays empty), so dropping that entry or re-adding the second route fails. +// body font itself, never by a third font. TMP Settings must route emoji by two named routes (operator ruling +// emoji-fallback-route): the global fallback names Emoji.asset and the emoji fallback list is exactly Emoji.asset, +// so dropping either fails. // Run as -executeMethod EmojiCheck.Run (exit 1 on failure in batchmode, as EngineAssetCheck). Corpus: // tools/emoji/emoji-singles.txt (from emoji-test.txt); the emoji Twemoji lacks are listed in // tools/emoji/emoji-unsupported.txt and reported, not rendered; -emojiLimit N spreads N entries evenly for a spike. @@ -45,11 +46,11 @@ public static class EmojiCheck return "nothing checked"; } - // One route: the global fallback names the emoji asset, and the emoji fallback list is empty. - if (TMP_Settings.emojiFallbackTextAssets != null && TMP_Settings.emojiFallbackTextAssets.Count > 0) - failures.Add("TMP Settings' emoji fallback list is not empty: a second emoji route exists (EmojiFont.Build leaves it empty)."); + // Two routes (operator ruling emoji-fallback-route): the emoji fallback list is exactly Emoji.asset, and the global list below names it. + if (TMP_Settings.emojiFallbackTextAssets == null || TMP_Settings.emojiFallbackTextAssets.Count != 1 || TMP_Settings.emojiFallbackTextAssets[0] != emoji) + failures.Add("TMP Settings' emoji fallback list is not exactly Emoji.asset: FE0F-followed bases the body font draws will not reach Twemoji."); if (TMP_Settings.fallbackFontAssets == null || !TMP_Settings.fallbackFontAssets.Contains(emoji)) - failures.Add("TMP Settings' global fallback list does not name Emoji.asset: the only emoji route is gone."); + failures.Add("TMP Settings' global fallback list does not name Emoji.asset: the route for every single code point is gone."); var unsupported = new HashSet(LoadCodePoints("emoji-unsupported.txt")); var corpus = LoadSingles().Where(cp => !unsupported.Contains(cp)).ToList(); @@ -109,18 +110,23 @@ public static class EmojiCheck text.text = string.Join(" ", slice.Select(ToText)); text.ForceMeshUpdate(); var visible = new List { 0 }; + var shown = new List { "" }; for (var c = 0; c < text.textInfo.characterCount; c++) { var info = text.textInfo.characterInfo[c]; - if (info.character == ' ') visible.Add(0); - else if (info.isVisible) visible[visible.Count - 1]++; + if (info.character == ' ') { visible.Add(0); shown.Add(""); } + else if (info.isVisible) + { + visible[visible.Count - 1]++; + shown[shown.Count - 1] += $" U+{(int)info.character:X}:{info.fontAsset.name}"; + } } if (visible.Count != slice.Count) failures.Add($"sequence chunk {i}: {visible.Count} groups rendered for {slice.Count} sequences"); for (var g = 0; g < Math.Min(visible.Count, slice.Count); g++) if (visible[g] != 1) { notOne++; - failures.Add($"sequence {slice[g]} rendered {visible[g]} visible characters, not one"); + failures.Add($"sequence {slice[g]} rendered {visible[g]} visible characters, not one:{shown[g]}"); } } diff --git a/Assets/Scripts/Editor/EmojiFont.cs b/Assets/Scripts/Editor/EmojiFont.cs index 276a3ffbd..9d50b95c1 100644 --- a/Assets/Scripts/Editor/EmojiFont.cs +++ b/Assets/Scripts/Editor/EmojiFont.cs @@ -10,10 +10,11 @@ using UnityEngine.TextCore.LowLevel; // The one writer of the emoji font asset and of TMP Settings' emoji routing. The font file is the // output of tools/emoji/fetch_emoji_font.py; the asset is a dynamic COLOR font asset whose atlas pages -// are cache, filled on first use at runtime and cleared here. Every TMP text reaches emoji through ONE -// route, TMP Settings' global fallback list; the emoji fallback list stays empty, and no component names -// an emoji font. (Measured: the global list alone resolves every single code point; the emoji list alone -// leaves 200 text-presentation emoji unresolved. A second route could only disagree with the first.) +// are cache, filled on first use at runtime and cleared here. Every TMP text reaches emoji through TMP +// Settings alone (no component names an emoji font), by two routes that both name only Emoji.asset (operator ruling +// emoji-fallback-route): the global fallback serves every code point, including the 200 text-presentation emoji the +// emoji list alone leaves unresolved; the emoji fallback list is what TMP tries first when FE0F follows, so a keycap +// or FE0F/ZWJ sequence whose first code point the body font also draws reaches Twemoji, whose ligatures collapse it. // Sequences (ZWJ, skin tone, flag, keycap) resolve only through the emoji font's GSUB ligatures, and TMP applies // them per component, gated by that component's font features: EnableLigatures writes `liga` into every // serialized TMP text and into TMP Settings (so a text created later inherits it); there is no global switch. @@ -70,15 +71,16 @@ public static class EmojiFont // The atlas pages are cache: Build leaves them empty, the same state EmojiCheck restores. asset.ClearFontAssetData(true); - // One route: the global fallback. It also serves text-presentation emoji (U+263A without FE0F). - TMP_Settings.emojiFallbackTextAssets = new List(); + // Two routes: the global fallback serves every code point (text-presentation emoji too, U+263A without FE0F); + // the emoji list is tried first when FE0F follows. + TMP_Settings.emojiFallbackTextAssets = new List { asset }; TMP_Settings.fallbackFontAssets = new List { asset }; TMP_Settings.defaultSpriteAsset = null; EditorUtility.SetDirty(asset); EditorUtility.SetDirty(TMP_Settings.instance); AssetDatabase.SaveAssets(); - message = "EmojiFont: built " + AssetPath + " and made it TMP Settings' only emoji route (the global fallback)."; + message = "EmojiFont: built " + AssetPath + " and named it in both of TMP Settings' emoji routes (the global fallback and the emoji fallback list)."; return true; } diff --git a/Assets/TextMesh Pro/Resources/TMP Settings.asset b/Assets/TextMesh Pro/Resources/TMP Settings.asset index 4358b57ba..069416487 100644 --- a/Assets/TextMesh Pro/Resources/TMP Settings.asset +++ b/Assets/TextMesh Pro/Resources/TMP Settings.asset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:825042ae3feb2a2caf1eafa6bc667f96982b8a03faccc90c1d65d2078457f042 -size 1869 +oid sha256:19c9ec14d2e0d0ca31177f52ec0a4a81d945bd9c5ead9f776c5bf51fbc22b344 +size 1938