PoomSmart / EmojiLibrary

Global headers, functions and resources used by PoomSmart's Emoji tweaks.
MIT License
131 stars 10 forks source link

Help please! How can I implement the skin tone selection element for multiSkin emoji? #26

Closed izyumkin closed 1 year ago

izyumkin commented 1 year ago

I'm making a library that adds a picker emoji in the macOS style. I wrote an article about it.

I couldn't find a way to implement a skin tone picker for multiSkin emoji, since I didn't find a code that would paint the half of the emoji with a solid color.

Like here in the picture:

4

I see that you have succeeded in that. Maybe you can tell me how I can do this in my project?

P.S. I store emojis in this format: [0x1F600]

PoomSmart commented 1 year ago

I see those are the "two parts emojis" you mentioned in the article. These two parts emojis are specific to Apple. Apple just invented a fancy way of choosing the skin of each of the "pair".

The grayed out emojis you see are called silhouettes. They are not part of Unicode standards.

PoomSmart commented 1 year ago

If I'm not wrong, for the first two rows where each contains every possible skin, the underlying code points are of the same emoji but in full. For example, the top left is a woman-man kissing emoji in light skin tone. However, it and the rest in the two rows are masked (by masked, I mean either left or right emoji is masked) by the OS. The bottom right where both left and right are doubly masked.

PoomSmart commented 1 year ago

To achieve those masking, check out: https://github.com/PoomSmart/EmojiPort-PE/blob/master/MultiSkinEmojis.x#L93

The idea is creating a UIFont with appropriate attributes for masking those emojis.

PoomSmart commented 1 year ago

And FWIW, these paired emojis are actually a composition of two different glyphs in the AppleColorEmoji font. Fancy, eh?

image
izyumkin commented 1 year ago

This is crazy! I thought everything would be easier and it would be possible to find the hex value that will be responsible for masking in gray...

After studying your repository, I saw a mention of "silhouette" and found in the list of emojis: "1F464 # 👤 0.6 bust in silhouette" For a moment I thought I had found a solution, but it didn't work when I inserted this value in place of the skin tone🥲

Thanks for the answer, it was very helpful!

PoomSmart commented 1 year ago

References to "silhouette" in Unicode data has nothing to do with the "silhouette" I mentioned above though. 😁

izyumkin commented 1 year ago

Yes, I've already figured that out😄