yeslogic / allsorts

Font parser, shaping engine, and subsetter implemented in Rust
https://yeslogic.com/blog/allsorts-rust-font-shaping-engine/
Apache License 2.0
706 stars 23 forks source link

Font::supports_emoji should consider existence of COLR/CPAL tables #43

Closed ctrlcctrlv closed 3 years ago

ctrlcctrlv commented 3 years ago

Just asking if the font has embedded images, as is currently done—

https://github.com/yeslogic/allsorts/blob/fef3d222be23035fbfa81d5e5013bf038d1c5f1c/src/font.rs#L620-L625

Is insufficient. Fonts may have embedded images, and only put them in the Latin range. Fonts may have no embedded images, but support emoji via COLR/CPAL—that's more common today on non-Apple platforms, actually.

Just an FYI.

wezm commented 3 years ago

Yes this method is perhaps poorly named. It's used by other code to determine when it should attempt to try to retrieve embedded images. Since we don't currently support COLR/CPAL it doesn't make sense to return true for that case. And you're right that embedded images may exist for non-emoji glyphs. I'll come up with a better name.

wezm commented 3 years ago

Fixed in https://github.com/yeslogic/allsorts/commit/7308f272c449fbb6a0a6819e92f0cb6fb2bd43b8