-
Notifications
You must be signed in to change notification settings - Fork 516
Description
This issue with monochrome Noto Emoji is distinct from the color emoji issue (#193).
#338 added support for non-Basic-Multilingual-Plane (BMP) characters, but uses Array.from
, which doesn't account for combined emoji.
It seems that Opentype.js has the glyph information needed, but the initial text-to-glyph translation is the issue:
https://opentype.js.org/glyph-inspector.html
Expected Behavior
Calling notoEmojiFont.draw(context, "👨👩👧👦")
should render
Current Behavior
Calling notoEmojiFont.draw(context, "👨👩👧👦")
renders
Possible Solution
-
If "ccmp" is not supported yet and would cover this, this issue can be closed as a duplicate of Consider adding support to more GSUB tags? #443.
-
Intl.Segmenter is a native solution, but isn't supported by Firefox yet.
const splitSegmentArray = (string) => Array.from(new Intl.Segmenter().segment(string)).map(x => x.segment);
console.log(splitSegmentArray("😅👨👩👧👦💖👩💻💔👩🌾🧡👨🏽🌾💜🖖🏾🌈"))
-
graphemer is a library-based solution. (It is a fairly big library.)
-
twemoji-parser is focused on parsing emoji sequences, so it's smaller than graphemer.
Steps to Reproduce (for bugs)
Live demo: https://gm69qn.csb.app
- Call
notoEmojiFont.stringToGlyphs("👨👩👧👦")
and get glyphs for "👨👩👧👦" interspersed with the combiner ("uni200D"
) instead of the one glyph for the combined family.
- Same for other combined emoji, like 👩💻, 👩🌾, 👨🏽🌾, 🖖🏾
Context
We're adding support for emoji to Cuttle CAD, which can render various fonts as vectors for laser cutting, etc.
Your Environment
- Version used: 1.3.4
- Font used: Noto Emoji (ttf)
- Browser Name and version: Various tested
- Operating System and version (desktop or mobile): Mac OS desktop
- Link to your project: https://gm69qn.csb.app