Add color emoji rendering for TTF fonts#582
Open
mariusandra wants to merge 1 commit into
Open
Conversation
Support all three OpenType color emoji formats: - COLR/CPAL layered vector glyphs (Twemoji, OpenMoji, Segoe UI Emoji) - CBDT/CBLC embedded PNG bitmaps (Noto Color Emoji) - sbix embedded PNG bitmaps (Apple Color Emoji) fillText draws color glyphs automatically, including through typeface fallbacks. Bitmap strikes are selected by font size and decoded PNGs are cached on the Typeface. New Typeface.hasColorGlyph proc. Also: - Bitmap-only fonts (no glyf/CFF, like Noto Color Emoji) now load. - Platform 0 (Unicode) cmap subtables are now parsed; Apple Color Emoji has no Windows cmap at all. - typeset skips zero-width format runes (ZWJ, variation selectors) so emoji sequences degrade into their individual emoji instead of tofu. - strokeText skips color glyphs instead of crashing on outline-less fonts. Tests use three tiny generated fonts (one per format, see generate_emoji_fonts.py) plus an 11 KB subset of the real Twemoji Mozilla COLRv0 font. Verified against full Apple Color Emoji, Noto Color Emoji and Twemoji Mozilla. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I wanted to see how complicated it would be to get TTF emojis rendering with Pixie.
And when I say "I", I mean Claude Fable.
Turns out it was just $27 of tokens (part of my subscription, so nothing really).
This PS seems to works and looks all right to me... and I wouldn't mind it merged... however considering how little the effort I put into it I won't be sad/surprised to see it closed.
Happy to do more human effort if it helps get this merged.