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

Unicode mapping, codepoint fixes, and tests! #37

Merged
merged 11 commits into from
Nov 11, 2013
Merged

Unicode mapping, codepoint fixes, and tests! #37

merged 11 commits into from
Nov 11, 2013

Conversation

javan
Copy link
Contributor

@javan javan commented Nov 6, 2013

Hot on the heels of the http://emojisaurus.com launch comes this hot pull request.

Inspired by #35, I added methods to convert name→unicode and unicode→name.

>> Emoji.unicode_for("+1")
=> "" [redacted to pass github's PR validation]
>> Emoji.name_for("\u{1F496}")
=> "sparkling_heart"

I added a suite of tests, one of which attempts to verify our unicode codepoints. Here's how it looked prior to this PR.

test-failure

I merged in #26 to fix all but one of those. Turns out 🌠's codepoint was misidentified so I fixed that up too (8e09854).

1f303-vs-1f320

That leaves us with one new failure because ⚠️we're missing an emoji⚠️

@juliamae, how did you generate the .pngs initially? We need a new one for "NIGHT WITH STARS" U+1F303

/cc @josh @trevorturk @asianmack @jonasd

@trevorturk
Copy link
Contributor

Neato!

I generated the emoji initially -- lemme see if I can get NIGHT WITH STARS...

@trevorturk
Copy link
Contributor

Hrm... I'm a bit confused. We already seem to have a 1F303 that's aliased as "stars" -- you know, I think they may have changed this between iOS versions... Any one have any ideas? I'm attaching what I believe is the right "night with stars" at the right size, but I'm not sure what to make of the code name conflict.

1f303

...pretty sure that's the right one (according to the OS X Font Book, anyway, which is where we got the original names...)

fontbook

@trevorturk
Copy link
Contributor

Oh, duh -- I skimmed over your comment about that, @javan. I'll add you to the repo and you can fix that up and merge this in, aight?

...aaand I see you're already a collaborator. Make it so! 👈

@javan
Copy link
Contributor Author

javan commented Nov 6, 2013

I think it got mixed up in #16 because http://code.iamcal.com/php/emoji/ has it wrong. See "night with stars" and "shooting star" there.

@trevorturk
Copy link
Contributor

Word -- this is ready to go, then. Drop in that image and merge 'er up, @javan

BTW I did the extraction with https://github.com/tmm1/emoji-extractor -- thanks @tmm1 🤘

@javan
Copy link
Contributor Author

javan commented Nov 6, 2013

150c509 ❤️

@jeremy
Copy link
Contributor

jeremy commented Nov 6, 2013

:man_in_business_suit_levitating:

@josh
Copy link
Contributor

josh commented Nov 6, 2013

Nice!

Have a few small comments.

unicodes = Dir["./images/emoji/unicode/*.png"].map { |fn| File.basename(fn) }
aliases = Dir["./images/emoji/*.png"].select { |fn| File.symlink?(fn) }.map { |fn| File.basename(fn) }
used_unicodes = aliases.map { |name| File.basename(File.readlink("./images/emoji/#{name}")) }.uniq
puts unicodes - used_unicodes
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was like "hey, why did you delete this!" at first, but I actually ❤️ the idea of making it a test. It should always be true.

@josh
Copy link
Contributor

josh commented Nov 6, 2013

I like the method names here better than #35.

@josh
Copy link
Contributor

josh commented Nov 6, 2013

Ah, rad, I wanted to merge #26 a long time ago, but I think I hit that issue as well. Nice.

@javan
Copy link
Contributor Author

javan commented Nov 6, 2013

I figured out now to snarf Apple's emoji dictionary (https://github.com/github/gemoji/blob/unicode-mapping/Rakefile#L10-L16) and comparing their emoji to ours, it looks like we've got a bunch of code points that need updating. 😐

codepoints

@trevorturk
Copy link
Contributor

Weird -- just looks like we need to remove the "-fe0f" from all of those. Anyone know what that's about?

@javan
Copy link
Contributor Author

javan commented Nov 6, 2013

My test output isn't super clear. The format is:

[Apple's unicode char] (Apple's code points) - [Our unicode char] (our code points) [our name]

So, we need to add "fe0f" to many of ours. Looks like it's to disambiguate emoji from its plain text twin. Like ♣️ and ♣. Not sure we ever had the code points right.

@josh
Copy link
Contributor

josh commented Nov 6, 2013

Possible related history #20.

@javan
Copy link
Contributor Author

javan commented Nov 10, 2013

56da9a8 explains the "fe0f" variation selector and adds support for it. We should be all caught up with the latest emojis and their code points now.

@josh
Copy link
Contributor

josh commented Nov 10, 2013

Rad.

Feel free to merge whenever you like.

Sent from my iPhone (in China)

On Nov 11, 2013, at 12:14 AM, Javan Makhmali notifications@github.com wrote:

56da9a8 explains the "fe0f" variation selector and adds support for it. We should be all caught up with the latest emojis and their code points now.


Reply to this email directly or view it on GitHub.

javan added a commit that referenced this pull request Nov 11, 2013
Unicode mapping, codepoint fixes, and tests!
@javan javan merged commit 69f625f into master Nov 11, 2013
@javan javan deleted the unicode-mapping branch November 11, 2013 02:43
@javan
Copy link
Contributor Author

javan commented Nov 11, 2013

Merged and tagged. I don't have permission to push a new gem though.

@trevorturk
Copy link
Contributor

Done.

🤘

@javan
Copy link
Contributor Author

javan commented Nov 15, 2013

Unfortunately, installing gemoji from rubygems (i.e. a .gem file) kills the unicode mapping because the symlinks are lost. It appears that building the gem copies all of the files specified in the gemspec (s.files = Dir["README.md", "images/**/*.png", ...), but follows the symlinks and copies the actual destination files. So, we're not missing any files, just symlinks, and we have twice the number of bytes necessary since the files are essentially duped.

Anyone know if this is a bug or feature, and if there's a way around it?

Installing from github works so that's one workaround.

# gem 'gemoji'
>> File.symlink? "/usr/local/var/rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/gemoji-1.5.0/images/emoji/cry.png"
=> false

# gem 'gemoji', github: 'github/gemoji'
>> File.symlink? "/usr/local/var/rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/bundler/gems/gemoji-7755a8a18197/images/emoji/cry.png"
=> true

@aroben
Copy link
Contributor

aroben commented Jan 24, 2014

It doesn't look to me like there's a way to store symlinks in a gem. Seems like we'll need to get that information elsewhere.

@javan
Copy link
Contributor Author

javan commented Jan 24, 2014

We could generate the mapping in some kind of pre-release task. For now,
installing from GitHub is a reasonable workaround.

On Friday, January 24, 2014, Adam Roben notifications@github.com wrote:

It doesn't look to me like there's a way to store symlinks in a gem. Seems
like we'll need to get that information elsewhere.


Reply to this email directly or view it on GitHubhttps://github.com//pull/37#issuecomment-33234608
.

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

Successfully merging this pull request may close these issues.

6 participants