Repository navigation
Conversation
Colour-emoji families over the 64 MB scan cap, including Apple Color Emoji, load by name. sbix and CBDT PNG strikes paint in colour, so a grinning face is no longer an empty outline. Co-authored-by: Cursor <cursoragent@cursor.com>
f16cb3d to
ea7d5da
Compare
FredApps
left a comment
There was a problem hiding this comment.
ReviewerA — source-read COMMENT (not an approval)
I read the head of the diff: emoji fall back to the installed colour font and draw in colour (Apple Color Emoji on macOS, from its sbix PNG strikes). The code looks for named colour-emoji families first, because Apple Color Emoji is one file of about 180 MB, over the general scan's cap. Apple Color Emoji is Apple's font, licensed for use on Apple systems: drawing with it on screen is fine, but its glyph images must not be copied into exported files (a PDF or PPTX) or bundled, and the PR should say that the export path uses a different, openly licensed emoji font (Noto Color Emoji, OFL) or text. Loading a 180 MB file affects memory and start time, so it should be loaded lazily and only when an emoji appears (the code seems to do that). I have not run it (macOS), and no exact-head CI result exists for this head. Nothing was run.
I ran nothing and have no exact-head CI result for this PR, so this is not an approval. Where a diff was long I read its code hunks rather than every generated or documentation line.
Status: waiting_author.
aiongg
left a comment
There was a problem hiding this comment.
AI-generated review (Opus). Not a maintainer decision.
Small fixes needed (not certain):
Colour emoji now come from the installed colour-emoji font even when it is over the colour-font scan's size cap, and glyphs with embedded PNG strikes (sbix, CBDT) draw from those images instead of their empty outlines.
- crates/fonts/src/fontdb.rs:1411-1422 reimplements load_cataloged without taking the
loadinglock, so two threads can each read the 180 MB file at once. Callingself.load_cataloged(fam)keeps one load at a time and uses the usual file-size cap. - crates/render/src/bitmap.rs:66-70 decodes the PNG before checking its size. Only the image decoder's default allocation limit protects against a strike that claims a huge size.
- crates/render/src/bitmap.rs:16-19: the cache can hold 128 strikes of up to 2048x2048 pixels each, which is large next to real emoji strikes.
- crates/fonts/src/fontdb.rs:1399 also matches the monochrome Noto Emoji family, so that font loads as a side effect when it is installed.
- crates/render/src/lib.rs:2268-2272 tries COLR first and then the bitmap strike, so faces with only COLR glyphs draw as before.
Claims checked:
- verified: Emoji resolve to an installed colour-emoji family even when its file is larger than the 64 MB colour-font scan cap. (crates/fonts/src/fontdb.rs:1372 calls load_named_emoji_font before the 64 MB scan at line 1379. Lines 1397-1428 load the cataloged emoji families from SYSTEM_FALLBACKS (fontdb.rs:366…
- verified: Colour glyphs paint their embedded PNG strikes (sbix, and CBDT when the strike is a PNG) instead of an empty outline. (crates/render/src/lib.rs:2270 falls back to bitmap::paint when colr::paint returns false. crates/render/src/bitmap.rs:38-48 looks up the strike for the current ppem, and bitmap.rs:…
- unverified: On macOS a 72 pt grinning face renders yellow, right way up, inside the text box. (The placement logic is at crates/render/src/bitmap.rs:78-85: outer bearings in font units, inner bearings in pixels, and the bitmap moved up by its height for an sbix strike. The check for it, crates/render/src/tests…
Recommendation: merge after the fixes above; they may be pushed to this branch.
Reviewed at ea7d5da.
|
Automated message. Not a maintainer decision. This branch conflicts with main. Could you merge or rebase main into it? The conflict needs a person to resolve. |
|
Thanks for this. I tried it against current Where the call goes after a rebase. A machine whose first colour font lacks skin tones. With the call in the right place, I have a small companion change: when no loaded colour face draws the whole cluster, search by the first part none of them draws (🏽 here) instead of the base. It's about 20 lines in Would you like to fold it into this PR, or shall I open it as a separate PR once this one lands? |
Summary
sbix, andCBDTwhen the strike is a PNG), so a grinning face draws in colour instead of an empty outline.Test plan
cargo fmt --all -- --checkcargo clippy --workspace --all-targets -- -D warningscargo test --workspace, apart from the three known macOS environment failurescargo xtask assets,cargo xtask layers,cargo xtask wasm