Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emoji support #90

Open
LukeTOBrien opened this issue Jul 24, 2020 · 4 comments
Open

Emoji support #90

LukeTOBrien opened this issue Jul 24, 2020 · 4 comments

Comments

@LukeTOBrien
Copy link

LukeTOBrien commented Jul 24, 2020

Hello there,

I've noticed an issue with Emoji, some Emoji are two charecters or more, upon applying lettering the characters are split and the Emoji no longer displays, instead you get the default broken charecter.
If I get time I will create an example oon codePen, but I think you get the idea.

Thanks

Luke

@davatron5000
Copy link
Owner

This is maybe tough to support because more modern emoji are actually combinations of multiple emojis but with with zero-width joiners.

// pseudo code
"👩‍🚀".split() // ["👩‍", "", "🚀"]

If you have time to make a CodePen, I can poke at it some.

@LukeTOBrien
Copy link
Author

Could we use some fancy regex patten to avoid splitting the emoji?
https://stackoverflow.com/questions/47274478/how-to-exclude-escaped-characters-in-split-javascript

I will try to get some time to do this.

@LukeTOBrien
Copy link
Author

LukeTOBrien commented Jul 25, 2020

I have created a Pen that looks promising.
If you do inspect element on the output you will see - I am using match instead of split.

Split

"Hello 🐒".split('')

Array(8) [ "H", "e", "l", "l", "o", " ", "\ud83d", "\udc12" ]

Match

"Hello 🐒".match(/(\w)|([^\u0000-\u007F]+)/g)

Array(6) [ "H", "e", "l", "l", "o", "🐒" ]

"Hello 👩•🚀".match(/(\w)|([^\u0000-\u007F]+)/g)

Array(6) [ "H", "e", "l", "l", "o", "👩‍🚀" ]

@jacopomazzoni
Copy link

jacopomazzoni commented Oct 24, 2024

hey textillate had the same issue and they had solved it before moving to .lettering this way:
jschr/textillate#94

specifically here:
rymcol/textillate@6b9f15d

any change this could be implemented in .lettering too so that textillate would support this again?

it seems like a good thing to support

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants