xoudini / emojica

A Swift framework for using custom emoji in strings.
Apache License 2.0
106 stars 15 forks source link

Some emojis do not work #5

Closed chriswill0w closed 6 years ago

chriswill0w commented 7 years ago

Some of the emojis which can be found here https://getemoji.com in the section "New 2017 Emojis released in June 2017" are not detected at all or are detected as "two emojis" (face plus modifier). furthermore a lot of the people emojis with skin color modifier are detected incorrectly and rendered as two emojis (face plus modifier). How can I fix this? btw why are some huge blocks commented out in the Unicode.swift file?

I am using twemoji image files as they are supplied in the twemoji repo. I did not change the file names. Tested with iOS 11.

xoudini commented 7 years ago

Yes, admittedly the Unicode 10 standard hasn't been implemented into the framework as of now, but I'll make sure to do that as soon as possible (give it a week or so). I'll also look into Emoji 5.0 specifics at the same time.

As for the 'huge blocks' commented out in the Unicode.swift file: the code points present in the ignored code are accounted for in other methods. The commented blocks are somewhat specialised and aren't really essential to the functionality of the framework, you can read a more detailed description at line 1262 onwards in the same file.

chriswill0w commented 7 years ago

sound great, thanks! do you have any idea why all the emojis with the skin and gender modifiers (should have been included already before Unicode 10, right?) do not seem to work? can you confirm that?

xoudini commented 7 years ago

@ltblueberry0 I'll have to look into it, so give me a day or two to investigate. If you could give me specific code points at which the conversion fails, that would be very helpful.

chriswill0w commented 7 years ago

most of these emojis are not working (same for other skin tones):

let emojica = Emojica()
somelabel.attributedText = emojica.convert(string: " ๐Ÿ‘ฑ๐Ÿพโ€โ™€๏ธ ๐Ÿ‘ฑ๐Ÿพ ๐Ÿ‘ด๐Ÿพ ๐Ÿ‘ต๐Ÿพ ๐Ÿ‘ฒ๐Ÿพ ๐Ÿ‘ณ๐Ÿพโ€โ™€๏ธ ๐Ÿ‘ณ๐Ÿพ ๐Ÿ‘ฎ๐Ÿพโ€โ™€๏ธ ๐Ÿ‘ฎ๐Ÿพ ๐Ÿ‘ท๐Ÿพโ€โ™€๏ธ ๐Ÿ‘ท๐Ÿพ ๐Ÿ’‚๐Ÿพโ€โ™€๏ธ ๐Ÿ’‚๐Ÿพ ๐Ÿ•ต๐Ÿพโ€โ™€๏ธ ๐Ÿ•ต๐Ÿพ ๐Ÿ‘ฉ๐Ÿพโ€โš•๏ธ ๐Ÿ‘จ๐Ÿพโ€โš•๏ธ ๐Ÿ‘ฉ๐Ÿพโ€๐ŸŒพ ๐Ÿ‘จ๐Ÿพโ€๐ŸŒพ ๐Ÿ‘ฉ๐Ÿพโ€๐Ÿณ ๐Ÿ‘จ๐Ÿพโ€๐Ÿณ ๐Ÿ‘ฉ๐Ÿพโ€๐ŸŽ“ ๐Ÿ‘จ๐Ÿพโ€๐ŸŽ“ ๐Ÿ‘ฉ๐Ÿพโ€๐ŸŽค ๐Ÿ‘จ๐Ÿพโ€๐ŸŽค ๐Ÿ‘ฉ๐Ÿพโ€๐Ÿซ ๐Ÿ‘จ๐Ÿพโ€๐Ÿซ ๐Ÿ‘ฉ๐Ÿพโ€๐Ÿญ ๐Ÿ‘จ๐Ÿพโ€๐Ÿญ ๐Ÿ‘ฉ๐Ÿพโ€๐Ÿ’ป ๐Ÿ‘จ๐Ÿพโ€๐Ÿ’ป ๐Ÿ‘ฉ๐Ÿพโ€๐Ÿ’ผ ๐Ÿ‘จ๐Ÿพโ€๐Ÿ’ผ ๐Ÿ‘ฉ๐Ÿพโ€๐Ÿ”ง ๐Ÿ‘จ๐Ÿพโ€๐Ÿ”ง ๐Ÿ‘ฉ๐Ÿพโ€๐Ÿ”ฌ ๐Ÿ‘จ๐Ÿพโ€๐Ÿ”ฌ ๐Ÿ‘ฉ๐Ÿพโ€๐ŸŽจ ๐Ÿ‘จ๐Ÿพโ€๐ŸŽจ ๐Ÿ‘ฉ๐Ÿพโ€๐Ÿš’ ๐Ÿ‘จ๐Ÿพโ€๐Ÿš’ ๐Ÿ‘ฉ๐Ÿพโ€โœˆ๏ธ ๐Ÿ‘จ๐Ÿพโ€โœˆ๏ธ ๐Ÿ‘ฉ๐Ÿพโ€๐Ÿš€ ๐Ÿ‘จ๐Ÿพโ€๐Ÿš€ ๐Ÿ‘ฉ๐Ÿพโ€โš–๏ธ ๐Ÿ‘จ๐Ÿพโ€โš–๏ธ ๐Ÿคถ๐Ÿพ ๐ŸŽ…๐Ÿพ ๐Ÿ‘ธ๐Ÿพ ๐Ÿคด๐Ÿพ ๐Ÿ‘ฐ๐Ÿพ ๐Ÿคต๐Ÿพ ๐Ÿ‘ผ๐Ÿพ ๐Ÿคฐ๐Ÿพ ๐Ÿ™‡๐Ÿพโ€โ™€๏ธ ๐Ÿ™‡๐Ÿพ ๐Ÿ’๐Ÿพ ๐Ÿ’๐Ÿพโ€โ™‚๏ธ ๐Ÿ™…๐Ÿพ ๐Ÿ™…๐Ÿพโ€โ™‚๏ธ ๐Ÿ™†๐Ÿพ ๐Ÿ™†๐Ÿพโ€โ™‚๏ธ ๐Ÿ™‹๐Ÿพ ๐Ÿ™‹๐Ÿพโ€โ™‚๏ธ ๐Ÿคฆ๐Ÿพโ€โ™€๏ธ ๐Ÿคฆ๐Ÿพโ€โ™‚๏ธ ๐Ÿคท๐Ÿพโ€โ™€๏ธ ๐Ÿคท๐Ÿพโ€โ™‚๏ธ ๐Ÿ™Ž๐Ÿพ ๐Ÿ™Ž๐Ÿพโ€โ™‚๏ธ ๐Ÿ™๐Ÿพ ๐Ÿ™๐Ÿพโ€โ™‚๏ธ ๐Ÿ’‡๐Ÿพ ๐Ÿ’‡๐Ÿพโ€โ™‚๏ธ ๐Ÿ’†๐Ÿพ ๐Ÿ’†๐Ÿพโ€โ™‚๏ธ ๐Ÿ•ด๐Ÿพ ๐Ÿ’ƒ๐Ÿพ ๐Ÿ•บ๐Ÿพ ๐Ÿšถ๐Ÿพโ€โ™€๏ธ ๐Ÿšถ๐Ÿพ ๐Ÿƒ๐Ÿพโ€โ™€๏ธ ๐Ÿƒ๐Ÿพ ๐Ÿ‹๐Ÿพโ€โ™€๏ธ ๐Ÿ‹๐Ÿพ ๐Ÿคธ๐Ÿพโ€โ™€๏ธ ๐Ÿคธ๐Ÿพโ€โ™‚๏ธ โ›น๐Ÿพโ€โ™€๏ธ โ›น๐Ÿพ ๐Ÿคพ๐Ÿพโ€โ™€๏ธ ๐Ÿคพ๐Ÿพโ€โ™‚๏ธ ๐ŸŒ๐Ÿพโ€โ™€๏ธ ๐ŸŒ๐Ÿพ ๐Ÿ„๐Ÿพโ€โ™€๏ธ ๐Ÿ„๐Ÿพ ๐ŸŠ๐Ÿพโ€โ™€๏ธ ๐ŸŠ๐Ÿพ ๐Ÿคฝ๐Ÿพโ€โ™€๏ธ ๐Ÿคฝ๐Ÿพโ€โ™‚๏ธ ๐Ÿšฃ๐Ÿพโ€โ™€๏ธ ๐Ÿšฃ๐Ÿพ ๐Ÿ‡๐Ÿพ ๐Ÿšด๐Ÿพโ€โ™€๏ธ ๐Ÿšด๐Ÿพ ๐Ÿšต๐Ÿพโ€โ™€๏ธ ๐Ÿšต๐Ÿพ ๐Ÿคน๐Ÿพโ€โ™€๏ธ ๐Ÿคน๐Ÿพโ€โ™‚๏ธ ๐Ÿ›€๐Ÿพ")

(scroll to the right ;-))

using unmodified icons from twemoji

xoudini commented 7 years ago

Thanks! I'll get back to you shortly.

chriswill0w commented 7 years ago

some more info: for this example

let emojica = Emojica()
var test123 = emojica.convert(string: "๐Ÿ‘ฑ๐Ÿพโ€โ™€๏ธ๐Ÿ‘ฑ๐Ÿพ")

renders 4 images instead of two. it shows 3 images for the woman and one correct one for the man.

events: private func replacement(for emoji: EmojiHandler) -> NSAttributedString? -> name "1f471-1f3fe-2640" -> no image found private func fallback(for emoji: EmojiHandler) -> NSAttributedString -> name "2640" -> image found -> name "1f3fe" -> image found -> name "1f471" -> image found private func replacement(for emoji: EmojiHandler) -> NSAttributedString? -> name "1f471-1f3fe.png" -> image found

xoudini commented 7 years ago

@ltblueberry0

All of the above should now work with the version on the master branch, and I pushed the update to Cocoapods as well.

I'll also fix the warnings as soon as possible, so don't panic.

xoudini commented 7 years ago

And as for this:

I am using twemoji image files as they are supplied in the twemoji repo. I did not change the file names.

You'll need to run the renaming script for all twemoji glyphs to work properly, just follow the instructions here.