Compare commits

...

79 Commits

Author SHA1 Message Date
Kristján Oddsson
8d7c6fa4e3 bump version 2019-04-25 11:19:03 +01:00
Kristján Oddsson
21c4e27ee2 Merge pull request #151 from github/policewoman-is-also-a-cop
👮‍♀️ Add "police", "law" and "cop" as tags for 👮‍♀️
2019-04-25 11:18:16 +01:00
Kristján Oddsson
aed88bb347 add "police", "law" and "cop" as tags for 👮‍♀️ 2019-04-18 08:38:24 +01:00
Mike McQuaid
b04991b001 Merge pull request #140 from github/contributing-license
CONTRIBUTING: note license.
2018-02-16 09:30:59 +00:00
Mike McQuaid
8d6aff3fc6 CONTRIBUTING: note license.
This is to be more explicit about the contribution process and license.
2018-02-16 09:09:16 +00:00
Joshua Peek
3f6057146c Merge pull request #125 from github/sass
Add "sassy" alias to information desk people
2017-05-22 09:32:14 -07:00
Joshua Peek
61e16ae891 Add "sassy" alias to information desk people 2017-05-20 19:47:16 -07:00
Mislav Marohnić
9b8ad85de0 Merge branch 'unicode-aliases'
Fixes #122
2017-04-21 16:32:11 +02:00
Mislav Marohnić
09125ab983 Fix rendering of custom emoji in db/index.html 2017-04-21 16:31:32 +02:00
Mislav Marohnić
b9ce241bf1 Regenerate emoji.json with minimal raw representations
If a raw representation of emoji includes VARIATION SELECTOR 16, but a
browser would render it as a color emoji even without that character,
drop the VARIATION SELECTOR 16 from the raw representation.
2017-04-21 16:31:32 +02:00
Mislav Marohnić
ed954928d7 Improve script for detecting supported unicode aliases 2017-04-21 16:31:31 +02:00
Mislav Marohnić
7858e79566 Merge pull request #116 from skunkmb/master
Add a laugh alias and a hooray alias to 😄 and 🎉
2017-02-16 12:00:55 +01:00
Skunk
7bdd3f657f Use tags instead of aliases for laugh and hooray
As mentioned by @mislav in github/gemoji#116, too many aliases can be
tricky, but tags don’t need to be unique. Therefore, replace new aliases
with new tags for the recently changed 😄 and 🎉 emoji.
2017-02-15 16:23:33 -08:00
Skunk
68af9e3320 Add a laugh alias and a hooray alias to 😄 and 🎉
In the GitHub Reactions menu, there are six emoji: 👍, 👎, 😄, 🎉, 😕, and
❤️. However, two out of the six (😄 and 🎉) have descriptions (“Laugh”
and “Hooray”) that do not actually correspond to Gemoji aliases. Add new
aliases to those two Gemoji so that they directly correspond to the
GitHub Reactions.
2017-02-12 08:41:46 -08:00
Mislav Marohnić
7d27517382 gemoji 3.0.0 2016-12-21 17:14:05 +01:00
Mislav Marohnić
53325ab398 Allow specifying image size to extract 2016-12-21 17:12:58 +01:00
Mislav Marohnić
09f66fc38a gemoji 3.0.0.rc2 2016-12-20 17:36:21 +01:00
Mislav Marohnić
342b76f06e Merge branch 'ios-10.2' 2016-12-20 17:34:49 +01:00
Mislav Marohnić
6b556ba8b2 Update integrity test
These images are finally no longer identical.
2016-12-20 17:34:00 +01:00
Mislav Marohnić
74a321c07a Fix filling in emoji that historically had default gender
Now in iOS 10.2 there are gendered emoji that don't have a default
genderless unicode variant.
2016-12-20 17:34:00 +01:00
Mislav Marohnić
7e10d1a38a Change egg in a pan to "fried_egg" since "egg" is now an emoji 2016-12-20 17:34:00 +01:00
Mislav Marohnić
8ff20db97f Add new iOS 10.2 emoji 2016-12-20 17:34:00 +01:00
Mislav Marohnić
492e18f849 Reorder existing emoji according to iOS 10.2 palette 2016-12-20 17:34:00 +01:00
Mislav Marohnić
cf852befd9 Improve dump script for new emoji 2016-12-20 17:33:52 +01:00
Mislav Marohnić
9d313238bd Remove Gemfile.lock from version control
I don't like that Bundler now makes Gemfile.lock change whenever I bump
up gemoji version. There aren't many dependencies, so a missing
Gemfile.lock won't slow down CI too much.
2016-12-20 15:15:28 +01:00
Alexander Kotov
840655ad6b Fix NoMethodError in multithreading
Fixes #109, closes #111
2016-12-20 15:13:35 +01:00
Mislav Marohnić
f394c85d80 Fix Gemfile.lock 2016-09-30 13:18:43 -04:00
Mislav Marohnić
42a606c804 Merge pull request #99 from mikeastock/fix-sierra-typo
Fix typo in README of Sierra
2016-09-30 08:17:27 -09:00
Michael Stock
21c4cfe247 Fix typo in README of Sierra 2016-09-29 23:14:17 -07:00
Mislav Marohnić
31a6c8b97b gemoji 3.0.0.rc1 2016-09-29 17:48:13 -04:00
Mislav Marohnić
36d295f2b7 There are no more Apple images included in the project
References #61
2016-09-29 17:21:16 -04:00
Mislav Marohnić
d3b9f412c9 Merge branch 'ios-10'
Closes #96, closes #93, closes #77, closes #61

References #72
2016-09-29 17:11:06 -04:00
Mislav Marohnić
a71ba68b6d Expose extra Emoji::Character metadata fields
`category`, `description`, `ios_version`, `unicode_version`
2016-09-29 17:04:39 -04:00
Mislav Marohnić
380fd48cfd Skip image integrity tests on non-macOS platforms
Only run integrity tests if the local `images/unicode` directory exists.
2016-09-29 16:50:19 -04:00
Mislav Marohnić
1e485abfe0 images/emoji/*.pngimages/*.png 2016-09-29 16:50:19 -04:00
Mislav Marohnić
537ccc48ed Replace rake emoji task with a new gemoji executable
The availability of `gemoji extract` command allows easy extraction of
emoji assets into non-Rails applications.
2016-09-29 16:50:19 -04:00
Mislav Marohnić
9cf53bf513 Strip zero-width joiner from Emoji::Character#image_filename 2016-09-29 15:41:51 -04:00
Mislav Marohnić
0e72fb70cc Improve test for invalid or duplicate aliases 2016-09-29 15:41:51 -04:00
Mislav Marohnić
8db519ecbe Add unicode alias for emoji that has implicit gender
Some emoji have gendered variants, but their default rendering (when
they don't include a gender symbol) is using a specific gender for
historic reasons. Ensure that these emoji contain a representation with
explicit gender symbol in their `unicode_aliases`.

Example: ensures that "sleuth or spy" (1F575) is also found as:

    1F575: sleuth or spy
     FE0F: variation selector-16
     200D: zero width joiner
     2642: male sign
     FE0F: variation selector-16
2016-09-29 15:41:51 -04:00
Mislav Marohnić
d0d9227065 Finalize new extractor script mapping glyphs to emoji 2016-09-29 15:41:51 -04:00
Mislav Marohnić
72e9749225 Fix images extractor for macOS Sierra
The TTFunk dependency didn't have support for parsing `ttc` files. Now
parsing is done manually and there is no dependencies.
2016-09-29 15:39:45 -04:00
Mislav Marohnić
16c7e21e5e Remove images extracted from Apple Color Emoji font
These won't ship with the library anymore. Instead, the library ships
with a script that extracts these from macOS Sierra.
2016-09-29 15:39:45 -04:00
Mislav Marohnić
cb3ab19847 Provide public API for Apple's character palette data 2016-09-29 15:39:44 -04:00
Mislav Marohnić
9ffd0e63aa Import emoji up to and including iOS 10 2016-09-29 15:39:44 -04:00
Mislav Marohnić
50865e8895 Merge pull request #86 from marconilanna/patch-1
🍊 tangerine aliases: orange and mandarin
2016-02-26 15:58:37 +09:00
Mislav Marohnić
a76d5f02f4 Try Ruby "2.3.0" instead of just "2.3"
https://travis-ci.org/github/gemoji/jobs/111940056
2016-02-26 15:54:30 +09:00
Mislav Marohnić
be21932d23 Run on new Travis infrastructure 2016-02-26 15:51:35 +09:00
Mislav Marohnić
ee403f0b7d Test against Ruby 2.3.x in CI 2016-02-05 14:52:43 +11:00
Mislav Marohnić
75d8b4374b Tweak script/bootstrap 2016-02-05 14:52:21 +11:00
Marconi Lanna
6de1de2fa1 🍊 tangerine aliases: orange and mandarin
Reference: http://emojipedia.org/tangerine/

> Also Known As
>
> Mandarin Emoji
> Orange Emoji
2016-02-04 09:01:31 -05:00
Mislav Marohnić
be21f6efc6 Merge pull request #82 from github/alias_ng_woman_for_no_good
consistency with 🙆‍♀️
2015-11-13 20:13:20 -05:00
Jason Salaz
f21379209f consistency with 🙆‍♀️ 2015-10-29 20:46:41 -06:00
Mislav Marohnić
b84bf23a5b Merge pull request #81 from jeffmcneill/master
Add "pout" as an alias to the "pouting face" emoji
2015-10-05 14:30:01 +02:00
Jeff McNeill
b05ddab3b9 Merge pull request #1 from jeffmcneill/jeffmcneill-patch-1
Add "pout" as an alias to the "pouting face" emoji
2015-10-05 18:37:21 +07:00
Jeff McNeill
365c7a184c Add "pout" as an alias to the "pouting face" emoji
The use of the term "rage" is not the same semantically, though the Apple implementation of "pouting face" is essentially the "angry face" plus color red. However, other implementations have more "pouting"-like visages, and so use of "pout" would be helpful.
2015-10-05 18:36:58 +07:00
Mislav Marohnić
3db7811891 Merge pull request #79 from gavingmiller/master
Escape mkdir paths for rake emoji task
2015-08-03 14:22:35 -07:00
Gavin Miller
22e198644d Escape mkdir paths for rake emoji task
In the event that someone tries to copy the gemoji emoji's into their
project using the rake emoji task, if that person has braces ( or ) in
the path, the task will fail. Example of error:

sh: -c: line 0: syntax error near unexpected token `('
sh: -c: line 0: `mkdir -p /Users/gmiller/Dropbox (Personal)/projects/gavinmiller.io/public/images &&
  cp -Rp /Users/gmiller/.rbenv/versions/2.0.0-p598/lib/ruby/gems/2.0.0/gems/gemoji-2.1.0/images/emoji
  /Users/gmiller/Dropbox (Personal)/projects/gavinmiller.io/public/images'

By escaping the paths in the rake task, this problem no longer occurs.
2015-08-03 12:10:09 -06:00
Mislav Marohnić
677084b5ed Merge pull request #78 from mixmaxhq/jeff/fix_skin_tone_emoji
Fix image filename lookups for default emoji.
2015-07-21 12:31:18 -07:00
Jeff Wear
859778cc4b Fix image filename lookups for default emoji.
"Default emoji" == emoji that can be modified with skin tone modifiers.
2015-07-21 12:03:30 -07:00
Brandon Keepers
a8204fd8d3 Merge pull request #76 from github/code-of-conduct
Add code of conduct to contributing guidelines
2015-07-20 10:02:26 -07:00
Brandon Keepers
694f862f73 Add code of conduct to contributing guidelines 2015-07-08 14:19:45 -04:00
Mislav Marohnić
11b4f69f5a Merge pull request #68 from github/taco
🌮
2015-02-28 15:02:47 +13:00
Mislav Marohnić
4e6ce27ed6 Merge pull request #69 from janko-m/patch-1
Use image_path instead of asset_path in readme
2015-01-26 15:17:40 -08:00
Janko Marohnić
9308a10b52 Use image_path instead of asset_path in readme
In Rails 4.2 `#asset_path` has changed. Prior to Rails 4.2,
`#asset_path` would search all asset directories, and prepend the
appropriate asset type directory name to the result:

  asset_path("emoji/unicode/<id>.png")
  #=> "/images/emoji/unicode/<id>.png"

However, In Rails 4.2 `#asset_path` doesn't do that anymore, and assumes
that you've specified the correct folder. Since Emoji images are copied
to public/images/emoji/unicode, `#asset_path` would then generate the
wrong URL path:

  asset_path("emoji/unicode/<id>.png")
  #=> "/emoji/unicode/<id>.png"

Using `#image_path` fixes that, because that method looks specifically
for images/ folder, so it will find the Emoji images.
2015-01-26 23:53:48 +01:00
Mislav Marohnić
b841e20394 Merge pull request #67 from elektronaut/add-gif-support
Add support for non-PNG assets
2014-12-12 13:53:39 -08:00
Inge Jørgensen
ac3620cf89 Make image_filename customizable 2014-12-12 22:31:34 +01:00
Mislav Marohnić
60a473bfe5 🌮
http://www.glitchthegame.com/items/food/cold-taco/

Released under the public domain: http://www.glitchthegame.com/licensing/
2014-12-11 23:01:13 -08:00
Joshua Peek
df1b6fac6e Merge pull request #66 from asianmack/basecamp
Add emoji for :basecamp: and :basecampy:
2014-11-06 12:36:50 -08:00
Jamie Dihiansan
eda537e1a9 Add :basecamp: and :basecampy: to emoji.json 2014-11-06 12:49:49 -06:00
Jamie Dihiansan
9967b2ef28 Add emoji for :basecamp: and :basecampy: 2014-11-06 12:25:44 -06:00
Javan Makhmali
d41a53d459 Merge pull request #65 from tricknotes/ruby-2.2
Test against Ruby 2.2 on Travis CI
2014-10-23 09:44:44 -05:00
Ryunosuke SATO
06a2df3427 Test against Ruby 2.2 on Travis CI 2014-10-21 00:21:16 +09:00
Mislav Marohnić
757584d2b9 Merge pull request #63 from github/extractor
Extract PNG images from Apple's "Apple Color Emoji.ttf" font
2014-10-16 15:50:52 +02:00
Mislav Marohnić
f5092b7aa4 Tweak extractor.rb code style 2014-10-16 13:06:20 +02:00
Mislav Marohnić
8a9a8572aa Run the rest of the PNGs through ImageOptim
Command used:

    $ imageOptim -a -d images/emoji/
2014-09-25 10:19:41 -07:00
Mislav Marohnić
3d35b9f862 Simplify special case for "black_medium_square" in checksum test 2014-09-25 10:19:41 -07:00
Javan Makhmali
5dea160045 Update test for expected identical emoji checksums 2014-09-25 10:19:41 -07:00
Javan Makhmali
6984758915 Extract and optimize PNGs from "Apple Color Emoji.ttf"
Commands used:

    $ rake images:extract
    $ imageOptim -a -d images/emoji/unicode/

This required both ImageOptim and ImageAlpha to be installed as OS X apps.
2014-09-25 10:17:30 -07:00
Javan Makhmali
29c25127d0 Automate extracting PNG images from "Apple Color Emoji.ttf" 2014-09-25 10:17:29 -07:00
904 changed files with 16776 additions and 6585 deletions

9
.gitignore vendored
View File

@@ -1,2 +1,9 @@
/bin/*
!/bin/gemoji
.bundle
.ruby-version
db/NamesList.txt
Gemfile.lock
db/emoji-test.txt
db/ucd.nounihan.grouped.xml
images/unicode/*.png
vendor/

View File

@@ -1,6 +1,9 @@
sudo: false
script: script/test
rvm:
- 1.9.3
- 2.1.2
- '2.1'
- '2.2'
- 2.3.0
notifications:
email: false

View File

@@ -1,3 +1,8 @@
Contributions to this project are [released](https://help.github.com/articles/github-terms-of-service/#6-contributions-under-repository-license) to the public under the [project's open source license](LICENSE).
This project adheres to the [Open Code of Conduct][code-of-conduct]. By participating, you are expected to uphold this code.
[code-of-conduct]: http://todogroup.org/opencodeofconduct/#gemoji/opensource@github.com
Our emoji set is based off Apple's emoji character palette, plus some custom
emoji such as :octocat: :shipit: :metal:.

View File

@@ -1,6 +1,6 @@
source "https://rubygems.org"
gem "rake"
gem "minitest"
gem "rake", "~> 10.3.2"
gem "minitest", "~> 5.3.5"
gemspec

View File

@@ -1,18 +0,0 @@
PATH
remote: .
specs:
gemoji (2.1.0)
GEM
remote: https://rubygems.org/
specs:
minitest (5.3.5)
rake (10.3.2)
PLATFORMS
ruby
DEPENDENCIES
gemoji!
minitest
rake

View File

@@ -10,9 +10,6 @@ Copyright (c) 2013 id Software. All rights reserved.
trollface
Copyright (c) 2013 whynne@deviantart. All rights reserved.
All other images
Copyright (c) 2013 Apple Inc. All rights reserved.
Source code:
Copyright (c) 2013 GitHub, Inc.

View File

@@ -1,7 +1,8 @@
gemoji
======
Emoji images and names. See the LICENSE for copyright information.
This library contains character information about native emoji, as well as image
files for a few custom emoji.
Installation
@@ -13,36 +14,19 @@ Add `gemoji` to your Gemfile.
gem 'gemoji'
```
**Sync images**
### Extract images
Images can be copied to your public directory with `rake emoji` in your app. This is the recommended approach since the images will be available at a consistent location. This works best with cached formatted user content generated by tools like [html-pipeline](https://github.com/jch/html-pipeline).
To obtain image files as fallbacks for browsers and OS's that don't support
emoji, run the `gemoji extract` command **on macOS Sierra or later**:
``` ruby
# Rakefile
load 'tasks/emoji.rake'
``` sh
bundle exec gemoji extract public/images/emoji
```
```
$ rake emoji
```
This will extract images into filenames such as:
**Assets Precompiling**
If you must, you can manually add all the images to your asset load path.
``` ruby
# config/application.rb
config.assets.paths << Emoji.images_path
```
Then have them compiled to public on deploy.
``` ruby
# config/application.rb
config.assets.precompile << "emoji/**/*.png"
```
**WARNING** Since there are a ton of images, just adding the path may slow down other lookups if you aren't using it. Compiling all the emojis on deploy will add overhead to your deploy if even the images haven't changed. Theres just so many more superfluous files to iterate over. Also, the urls will be fingerprinted which may not be ideal for referencing from cached content.
* `public/images/emoji/octocat.png`
* `public/images/emoji/unicode/1f9c0.png` (the `:cheese:` emoji)
Example Rails Helper
@@ -57,7 +41,7 @@ module EmojiHelper
def emojify(content)
h(content).to_str.gsub(/:([\w+-]+):/) do |match|
if emoji = Emoji.find_by_alias($1)
%(<img alt="#$1" src="#{asset_path("emoji/#{emoji.image_filename}")}" style="vertical-align:middle" width="20" height="20" />)
%(<img alt="#$1" src="#{image_path("emoji/#{emoji.image_filename}")}" style="vertical-align:middle" width="20" height="20" />)
else
match
end
@@ -107,6 +91,14 @@ emoji.image_filename #=> "music.png"
As you create new emoji, you must ensure that you also create and put the images
they reference by their `image_filename` to your assets directory.
You can customize `image_filename` with:
```ruby
emoji = Emoji.create("music") do |char|
char.image_filename = "subdirectory/my_emoji.gif"
end
```
For existing emojis, you can edit the list of aliases or add new tags in an edit block:
```ruby

View File

@@ -9,7 +9,11 @@ end
namespace :db do
desc %(Generate Emoji data files needed for development)
task :generate => ['db/Category-Emoji.json', 'db/NamesList.txt']
task :generate => [
'db/Category-Emoji.json',
'db/ucd.nounihan.grouped.xml',
'db/emoji-test.txt',
]
desc %(Dump a list of supported Emoji with Unicode descriptions and aliases)
task :dump => :generate do
@@ -17,13 +21,25 @@ namespace :db do
end
end
emoji_plist = '/System/Library/Input Methods/CharacterPalette.app/Contents/Resources/Category-Emoji.plist'
nameslist_url = 'http://www.unicode.org/Public/6.3.0/ucd/NamesList.txt'
task 'db/Category-Emoji.json' do |t|
system "plutil -convert json -r '#{emoji_plist}' -o '#{t.name}'"
system 'plutil', '-convert', 'json', '-r',
'/System/Library/Input Methods/CharacterPalette.app/Contents/Resources/Category-Emoji.plist',
'-o', t.name
end
file 'db/NamesList.txt' do |t|
system "curl -fsSL '#{nameslist_url}' -o '#{t.name}'"
file 'db/ucd.nounihan.grouped.xml' do
Dir.chdir('db') do
system 'curl', '-fsSLO', 'http://www.unicode.org/Public/9.0.0/ucdxml/ucd.nounihan.grouped.zip'
system 'unzip', '-q', 'ucd.nounihan.grouped.zip'
rm 'ucd.nounihan.grouped.zip'
end
end
file 'db/emoji-test.txt' do |t|
system 'curl', '-fsSL', 'http://unicode.org/Public/emoji/4.0/emoji-test.txt', '-o', t.name
end
directory 'images/unicode' do
require 'emoji/extractor'
Emoji::Extractor.new(64, Emoji.images_path).extract!
end

5
bin/gemoji Executable file
View File

@@ -0,0 +1,5 @@
#!/usr/bin/env ruby
require 'emoji/cli'
exit_code = Emoji::CLI.dispatch(ARGV)
exit exit_code

View File

@@ -4,40 +4,64 @@
"CVDataTitle" : "EmojiCategory-People",
"CVCategoryImage" : "Emoji-HumanImage",
"CVCategoryData" : {
"CVSkipNullGlyphs" : true,
"Data" : "😄,😃,😀,😊,☺️,😉,😍,😘,😚,😗,😙,😜,😝,😛,😳,😁,😔,😌,😒,😞,😣,😢,😂,😭,😪,😥,😰,😅,😓,😩,😫,😨,😱,😠,😡,😤,😖,😆,😋,😷,😎,😴,😵,😲,😟,😦,😧,😈,👿,😮,😬,😐,😕,😯,😶,😇,😏,😑,👲,👳,👮,👷,💂,👶,👦,👧,👨,👩,👴,👵,👱,👼,👸,😺,😸,😻,😽,😼,🙀,😿,😹,😾,👹,👺,🙈,🙉,🙊,💀,👽,💩,🔥,✨,🌟,💫,💥,💢,💦,💧,💤,💨,👂,👀,👃,👅,👄,👍,👎,👌,👊,✊,✌️,👋,✋,👐,👆,👇,👉,👈,🙌,🙏,☝️,👏,💪,🚶,🏃,💃,👫,👪,👬,👭,💏,💑,👯,🙆,🙅,💁,🙋,💆,💇,💅,👰,🙎,🙍,🙇,🎩,👑,👒,👟,👞,👡,👠,👢,👕,👔,👚,👗,🎽,👖,👘,👙,💼,👜,👝,👛,👓,🎀,🌂,💄,💛,💙,💜,💚,❤️,💔,💗,💓,💕,💖,💞,💘,💌,💋,💍,💎,👤,👥,💬,👣,💭"
"CVSkipNullGlyphs" : false,
"Data" : "😀,😃,😄,😁,😆,😅,😂,🤣,☺️,😊,😇,🙂,🙃,😉,😌,😍,😘,😗,😙,😚,😋,😜,😝,😛,🤑,🤗,🤓,😎,🤡,🤠,😏,😒,😞,😔,😟,😕,🙁,☹️,😣,😖,😫,😩,😤,😠,😡,😶,😐,😑,😯,😦,😧,😮,😲,😵,😳,😱,😨,😰,😢,😥,🤤,😭,😓,😪,😴,🙄,🤔,🤥,😬,🤐,🤢,🤧,😷,🤒,🤕,😈,👿,👹,👺,💩,👻,💀,☠️,👽,👾,🤖,🎃,😺,😸,😹,😻,😼,😽,🙀,😿,😾,👐,🙌,👏,🙏,🤝,👍,👎,👊,✊,🤛,🤜,🤞,✌️,🤘,👌,👈,👉,👆,👇,☝️,✋,🤚,🖐,🖖,👋,🤙,💪,🖕,✍️,🤳,💅,💍,💄,💋,👄,👅,👂,👃,👣,👁,👀,🗣,👤,👥,👶,👦,👧,👨,👩,👱‍♀️,👱,👴,👵,👲,👳‍♀️,👳,👮‍♀️,👮,👷‍♀️,👷,💂‍♀️,💂,🕵️‍♀️,🕵️,👩‍⚕️,👨‍⚕️,👩‍🌾,👨‍🌾,👩‍🍳,👨‍🍳,👩‍🎓,👨‍🎓,👩‍🎤,👨‍🎤,👩‍🏫,👨‍🏫,👩‍🏭,👨‍🏭,👩‍💻,👨‍💻,👩‍💼,👨‍💼,👩‍🔧,👨‍🔧,👩‍🔬,👨‍🔬,👩‍🎨,👨‍🎨,👩‍🚒,👨‍🚒,👩‍✈️,👨‍✈️,👩‍🚀,👨‍🚀,👩‍⚖️,👨‍⚖️,🤶,🎅,👸,🤴,👰,🤵,👼,🤰,🙇‍♀️,🙇,💁,💁‍♂️,🙅,🙅‍♂️,🙆,🙆‍♂️,🙋,🙋‍♂️,🤦‍♀️,🤦‍♂️,🤷‍♀️,🤷‍♂️,🙎,🙎‍♂️,🙍,🙍‍♂️,💇,💇‍♂️,💆,💆‍♂️,🕴,💃,🕺,👯,👯‍♂️,🚶‍♀️,🚶,🏃‍♀️,🏃,👫,👭,👬,💑,👩‍❤️‍👩,👨‍❤️‍👨,💏,👩‍❤️‍💋‍👩,👨‍❤️‍💋‍👨,👪,👨‍👩‍👧,👨‍👩‍👧‍👦,👨‍👩‍👦‍👦,👨‍👩‍👧‍👧,👩‍👩‍👦,👩‍👩‍👧,👩‍👩‍👧‍👦,👩‍👩‍👦‍👦,👩‍👩‍👧‍👧,👨‍👨‍👦,👨‍👨‍👧,👨‍👨‍👧‍👦,👨‍👨‍👦‍👦,👨‍👨‍👧‍👧,👩‍👦,👩‍👧,👩‍👧‍👦,👩‍👦‍👦,👩‍👧‍👧,👨‍👦,👨‍👧,👨‍👧‍👦,👨‍👦‍👦,👨‍👧‍👧,👚,👕,👖,👔,👗,👙,👘,👠,👡,👢,👞,👟,👒,🎩,🎓,👑,⛑,🎒,👝,👛,👜,💼,👓,🕶,🌂,☂️"
}
},
{
"CVDataTitle" : "EmojiCategory-Nature",
"CVCategoryImage" : "Emoji-NatureImage",
"CVCategoryData" : {
"CVSkipNullGlyphs" : true,
"Data" : "🐶,🐺,🐱,🐭,🐹,🐰,🐸,🐯,🐨,🐻,🐷,🐽,🐮,🐗,🐵,🐒,🐴,🐑,🐘,🐼,🐧,🐦,🐤,🐥,🐣,🐔,🐍,🐢,🐛,🐝,🐜,🐞,🐌,🐙,🐚,🐠,🐟,🐬,🐳,🐋,🐄,🐏,🐀,🐃,🐅,🐇,🐉,🐎,🐐,🐓,🐕,🐖,🐁,🐂,🐲,🐡,🐊,🐫,🐪,🐆,🐈,🐩,🐾,💐,🌸,🌷,🍀,🌹,🌻,🌺,🍁,🍃,🍂,🌿,🌾,🍄,🌵,🌴,🌲,🌳,🌰,🌱,🌼,🌐,🌞,🌝,🌚,🌑,🌒,🌓,🌔,🌕,🌖,🌗,🌘,🌜,🌛,🌙,🌍,🌎,🌏,🌋,🌌,🌠,⭐,☀️,⛅️,☁️,⚡,,❄️,⛄️,🌀,🌁,🌈,🌊"
"CVSkipNullGlyphs" : false,
"Data" : "🐶,🐱,🐭,🐹,🐰,🦊,🐻,🐼,🐨,🐯,🦁,🐮,🐷,🐽,🐸,🐵,🙈,🙉,🙊,🐒,🐔,🐧,🐦,🐤,🐣,🐥,🦆,🦅,🦉,🦇,🐺,🐗,🐴,🦄,🐝,🐛,🦋,🐌,🐚,🐞,🐜,🕷,🕸,🐢,🐍,🦎,🦂,🦀,🦑,🐙,🦐,🐠,🐟,🐡,🐬,🦈,🐳,🐋,🐊,🐆,🐅,🐃,🐂,🐄,🦌,🐪,🐫,🐘,🦏,🦍,🐎,🐖,🐐,🐏,🐑,🐕,🐩,🐈,🐓,🦃,🕊,🐇,🐁,🐀,🐿,🐾,🐉,🐲,🌵,🎄,🌲,🌳,🌴,🌱,🌿,☘️,🍀,🎍,🎋,🍃,🍂,🍁,🍄,🌾,💐,🌷,🌹,🥀,🌻,🌼,🌸,🌺,🌎,🌍,🌏,🌕,🌖,🌗,🌘,🌑,🌒,🌓,🌔,🌚,🌝,🌞,🌛,🌜,🌙,💫,⭐️,🌟,✨,⚡️,🔥,💥,☄,☀️,🌤,⛅️,🌥,🌦,🌈,☁️,🌧,⛈,🌩,🌨,☃,,❄️,🌬,💨,🌪,🌫,🌊,💧,💦,☔️"
}
},
{
"CVDataTitle" : "EmojiCategory-Objects",
"CVCategoryImage" : "Emoji-ObjectsImage",
"CVDataTitle" : "EmojiCategory-Foods",
"CVCategoryImage" : "Emoji-FoodsImage",
"CVCategoryData" : {
"CVSkipNullGlyphs" : true,
"Data" : "🎍,💝,🎎,🎒,🎓,🎏,🎆,🎇,🎐,🎑,🎃,👻,🎅,🎄,🎁,🎋,🎉,🎊,🎈,🎌,🔮,🎥,📷,📹,📼,💿,📀,💽,💾,💻,📱,☎️,📞,📟,📠,📡,📺,📻,🔊,🔉,🔈,🔇,🔔,🔕,📢,📣,⏳,⌛️,⏰,⌚️,🔓,🔒,🔏,🔐,🔑,🔎,💡,🔦,🔆,🔅,🔌,🔋,🔍,🛁,🛀,🚿,🚽,🔧,🔩,🔨,🚪,🚬,💣,🔫,🔪,💊,💉,💰,💴,💵,💷,💶,💳,💸,📲,📧,📥,📤,✉️,📩,📨,📯,📫,📪,📬,📭,📮,📦,📝,📄,📃,📑,📊,📈,📉,📜,📋,📅,📆,📇,📁,📂,✂️,📌,📎,✒️,✏️,📏,📐,📕,📗,📘,📙,📓,📔,📒,📚,📖,🔖,📛,🔬,🔭,📰,🎨,🎬,🎤,🎧,🎼,🎵,🎶,🎹,🎻,🎺,🎷,🎸,👾,🎮,🃏,🎴,🀄️,🎲,🎯,🏈,🏀,⚽️,⚾️,🎾,🎱,🏉,🎳,⛳️,🚵,🚴,🏁,🏇,🏆,🎿,🏂,🏊,🏄,🎣,☕️,🍵,🍶,🍼,🍺,🍻,🍸,🍹,🍷,🍴,🍕,🍔,🍟,🍗,🍖,🍝,🍛,🍤,🍱,🍣,🍥,🍙,🍘,🍚,🍜,🍲,🍢,🍡,🍳,🍞,🍩,🍮,🍦,🍨,🍧,🎂,🍰,🍪,🍫,🍬,🍭,🍯,🍎,🍏,🍊,🍋,🍒,🍇,🍉,🍓,🍑,🍈,🍌,🍐,🍍,🍠,🍆,🍅,🌽"
"CVSkipNullGlyphs" : false,
"Data" : "🍏,🍎,🍐,🍊,🍋,🍌,🍉,🍇,🍓,🍈,🍒,🍑,🍍,🥝,🥑,🍅,🍆,🥒,🥕,🌽,🌶,🥔,🍠,🌰,🥜,🍯,🥐,🍞,🥖,🧀,🥚,🍳,🥓,🥞,🍤,🍗,🍖,🍕,🌭,🍔,🍟,🥙,🌮,🌯,🥗,🥘,🍝,🍜,🍲,🍥,🍣,🍱,🍛,🍚,🍙,🍘,🍢,🍡,🍧,🍨,🍦,🍰,🎂,🍮,🍭,🍬,🍫,🍿,🍩,🍪,🥛,🍼,☕️,🍵,🍶,🍺,🍻,🥂,🍷,🥃,🍸,🍹,🍾,🥄,🍴,🍽"
}
},
{
"CVDataTitle" : "EmojiCategory-Activity",
"CVCategoryImage" : "Emoji-ActivityImage",
"CVCategoryData" : {
"CVSkipNullGlyphs" : false,
"Data" : "⚽️,🏀,🏈,⚾️,🎾,🏐,🏉,🎱,🏓,🏸,🥅,🏒,🏑,🏏,⛳️,🏹,🎣,🥊,🥋,⛸,🎿,⛷,🏂,🏋️‍♀️,🏋️,🤺,🤼‍♀️,🤼‍♂️,🤸‍♀️,🤸‍♂️,⛹️‍♀️,⛹️,🤾‍♀️,🤾‍♂️,🏌️‍♀️,🏌️,🏄‍♀️,🏄,🏊‍♀️,🏊,🤽‍♀️,🤽‍♂️,🚣‍♀️,🚣,🏇,🚴‍♀️,🚴,🚵‍♀️,🚵,🎽,🏅,🎖,🥇,🥈,🥉,🏆,🏵,🎗,🎫,🎟,🎪,🤹‍♀️,🤹‍♂️,🎭,🎨,🎬,🎤,🎧,🎼,🎹,🥁,🎷,🎺,🎸,🎻,🎲,🎯,🎳,🎮,🎰"
}
},
{
"CVDataTitle" : "EmojiCategory-Places",
"CVCategoryImage" : "Emoji-PlacesImage",
"CVCategoryData" : {
"CVSkipNullGlyphs" : true,
"Data" : "🏠,🏡,🏫,🏢,🏣,🏥,🏦,🏪,🏩,🏨,💒,⛪️,🏬,🏤,🌇,🌆,🏯,🏰,⛺️,🏭,🗼,🗾,🗻,🌄,🌅,🌃,🗽,🌉,🎠,🎡,⛲️,🎢,🚢,⛵️,🚤,🚣,⚓️,🚀,✈️,💺,🚁,🚂,🚊,🚉,🚞,🚆,🚄,🚅,🚈,🚇,🚝,🚋,🚃,🚎,🚌,🚍,🚙,🚘,🚗,🚕,🚖,🚛,🚚,🚨,🚓,🚔,🚒,🚑,🚐,🚲,🚡,🚟,🚠,🚜,💈,🚏,🎫,🚦,🚥,⚠️,🚧,🔰,⛽️,🏮,🎰,♨️,🗿,🎪,🎭,📍,🚩,🇯🇵,🇰🇷,🇩🇪,🇨🇳,🇺🇸,🇫🇷,🇪🇸,🇮🇹,🇷🇺,🇬🇧"
"CVSkipNullGlyphs" : false,
"Data" : "🚗,🚕,🚙,🚌,🚎,🏎,🚓,🚑,🚒,🚐,🚚,🚛,🚜,🛴,🚲,🛵,🏍,🚨,🚔,🚍,🚘,🚖,🚡,🚠,🚟,🚃,🚋,🚞,🚝,🚄,🚅,🚈,🚂,🚆,🚇,🚊,🚉,🚁,🛩,✈️,🛫,🛬,🚀,🛰,💺,🛶,⛵️,🛥,🚤,🛳,⛴,🚢,⚓️,🚧,⛽️,🚏,🚦,🚥,🗺,🗿,🗽,⛲️,🗼,🏰,🏯,🏟,🎡,🎢,🎠,⛱,🏖,🏝,⛰,🏔,🗻,🌋,🏜,🏕,⛺️,🛤,🛣,🏗,🏭,🏠,🏡,🏘,🏚,🏢,🏬,🏣,🏤,🏥,🏦,🏨,🏪,🏫,🏩,💒,🏛,⛪️,🕌,🕍,🕋,⛩,🗾,🎑,🏞,🌅,🌄,🌠,🎇,🎆,🌇,🌆,🏙,🌃,🌌,🌉,🌁"
}
},
{
"CVDataTitle" : "EmojiCategory-Objects",
"CVCategoryImage" : "Emoji-ObjectsImage",
"CVCategoryData" : {
"CVSkipNullGlyphs" : false,
"Data" : "⌚️,📱,📲,💻,⌨️,🖥,🖨,🖱,🖲,🕹,🗜,💽,💾,💿,📀,📼,📷,📸,📹,🎥,📽,🎞,📞,☎️,📟,📠,📺,📻,🎙,🎚,🎛,⏱,⏲,⏰,🕰,⌛️,⏳,📡,🔋,🔌,💡,🔦,🕯,🗑,🛢,💸,💵,💴,💶,💷,💰,💳,💎,⚖️,🔧,🔨,⚒,🛠,⛏,🔩,⚙️,⛓,🔫,💣,🔪,🗡,⚔️,🛡,🚬,⚰️,⚱️,🏺,🔮,📿,💈,⚗️,🔭,🔬,🕳,💊,💉,🌡,🚽,🚰,🚿,🛁,🛀,🛎,🔑,🗝,🚪,🛋,🛏,🛌,🖼,🛍,🛒,🎁,🎈,🎏,🎀,🎊,🎉,🎎,🏮,🎐,✉️,📩,📨,📧,💌,📥,📤,📦,🏷,📪,📫,📬,📭,📮,📯,📜,📃,📄,📑,📊,📈,📉,🗒,🗓,📆,📅,📇,🗃,🗳,🗄,📋,📁,📂,🗂,🗞,📰,📓,📔,📒,📕,📗,📘,📙,📚,📖,🔖,🔗,📎,🖇,📐,📏,📌,📍,✂️,🖊,🖋,✒️,🖌,🖍,📝,✏️,🔍,🔎,🔏,🔐,🔒,🔓"
}
},
{
"CVDataTitle" : "EmojiCategory-Symbols",
"CVCategoryImage" : "Emoji-SymbolImage",
"CVCategoryData" : {
"CVSkipNullGlyphs" : true,
"Data" : "1⃣,2⃣,3⃣,4⃣,5⃣,6⃣,7⃣,8⃣,9⃣,0⃣,🔟,🔢,#️⃣,🔣,⬆,,,,🔠,🔡,🔤,↗️,↖,,↙️,↔,,🔄,◀,,🔼,🔽,↩,,,⏪,⏩,⏫,⏬,⤵️,⤴️,🆗,🔀,🔁,🔂,🆕,🆙,🆒,🆓,🆖,📶,🎦,🈁,🈯️,🈳,🈵,🈴,🈲,🉐,🈹,🈺,🈶,🈚️,🚻,🚹,🚺,🚼,🚾,🚰,🚮,🅿️,♿️,🚭,🈷,🈸,🈂,Ⓜ,🛂,🛄,🛅,🛃,🉑,㊙️,㊗️,🆑,🆘,🆔,🚫,🔞,📵,🚯,🚱,🚳,🚷,🚸,⛔️,✳️,❇️,❎,✅,✴️,💟,🆚,📳,📴,🅰,🅱,🆎,🅾,💠,➿,♻,,,,,,,,,,,,,⛎,🔯,🏧,💹,💲,💱,©,®,™,❌,‼️,⁉,,❓,❕,❔,⭕️,🔝,🔚,🔙,🔛,🔜,🔃,🕛,🕧,🕐,🕜,🕑,🕝,🕒,🕞,🕓,🕟,🕔,🕠,🕕,🕖,🕗,🕘,🕙,🕚,🕡,🕢,🕣,🕤,🕥,🕦,✖️,,,➗,♠️,,,♦️,💮,💯,✔️,☑️,🔘,🔗,➰,〰,〽️,🔱,◼️,◻️,◾️,◽️,▪️,▫️,🔺,🔲,🔳,⚫️,⚪️,🔴,🔵,🔻,⬜️,⬛️,🔶,🔷,🔸,🔹"
"CVSkipNullGlyphs" : false,
"Data" : "❤️,💛,💚,💙,💜,🖤,💔,❣️,💕,💞,💓,💗,💖,💘,💝,💟,☮️,✝️,☪️,🕉,☸️,✡️,🔯,🕎,☯️,☦️,🛐,⛎,♈️,♉️,♊️,♋️,♌️,♍,,,,♑️,♒️,♓️,🆔,⚛️,🉑,☢,,📴,📳,🈶,🈚️,🈸,🈺,🈷,,🆚,💮,🉐,㊙,,🈴,🈵,🈹,🈲,🅰,🅱,🆎,🆑,🅾️,🆘,❌,⭕️,🛑,⛔️,📛,🚫,💯,💢,♨️,🚷,🚯,🚳,🚱,🔞,📵,🚭,❗️,❕,❓,❔,‼️,⁉️,🔅,🔆,〽️,⚠️,🚸,🔱,⚜️,🔰,♻️,✅,🈯️,💹,❇️,✳️,❎,🌐,💠,Ⓜ️,🌀,💤,🏧,🚾,♿️,🅿️,🈳,🈂,🛂,🛃,🛄,🛅,🚹,🚺,🚼,🚻,🚮,🎦,📶,🈁,🔣,,🔤,🔡,🔠,🆖,🆗,🆙,🆒,🆕,🆓,0⃣,1⃣,2⃣,3⃣,4⃣,5⃣,6⃣,7⃣,8⃣,9⃣,🔟,🔢,#️⃣,*️⃣,▶️,⏸,⏯,⏹,⏺,⏭,⏮,⏩,⏪,⏫,⏬,◀️,🔼,🔽,➡️,⬅,,,,,,,,,,,,,🔀,🔁,🔂,🔄,🔃,🎵,🎶,,,➗,✖️,💲,💱,™,©,®️,〰️,➰,➿,🔚,🔙,🔛,🔝,🔜,✔️,☑️,🔘,⚪️,⚫️,🔴,🔵,🔺,🔻,🔸,🔹,🔶,🔷,🔳,🔲,▪️,▫️,◾️,◽️,◼️,◻️,⬛️,⬜️,🔈,🔇,🔉,🔊,🔔,🔕,📣,📢,👁‍🗨,💬,💭,🗯,♠️,,,♦️,🃏,🎴,🀄️,🕐,🕑,🕒,🕓,🕔,🕕,🕖,🕗,🕘,🕙,🕚,🕛,🕜,🕝,🕞,🕟,🕠,🕡,🕢,🕣,🕤,🕥,🕦,🕧"
}
},
{
"CVDataTitle" : "EmojiCategory-Flags",
"CVCategoryImage" : "Emoji-FlagsImage",
"CVCategoryData" : {
"CVSkipNullGlyphs" : false,
"Data" : "🏳️,🏴,🏁,🚩,🏳️‍🌈,🇦🇫,🇦🇽,🇦🇱,🇩🇿,🇦🇸,🇦🇩,🇦🇴,🇦🇮,🇦🇶,🇦🇬,🇦🇷,🇦🇲,🇦🇼,🇦🇺,🇦🇹,🇦🇿,🇧🇸,🇧🇭,🇧🇩,🇧🇧,🇧🇾,🇧🇪,🇧🇿,🇧🇯,🇧🇲,🇧🇹,🇧🇴,🇧🇶,🇧🇦,🇧🇼,🇧🇷,🇮🇴,🇻🇬,🇧🇳,🇧🇬,🇧🇫,🇧🇮,🇨🇻,🇰🇭,🇨🇲,🇨🇦,🇮🇨,🇰🇾,🇨🇫,🇹🇩,🇨🇱,🇨🇳,🇨🇽,🇨🇨,🇨🇴,🇰🇲,🇨🇬,🇨🇩,🇨🇰,🇨🇷,🇨🇮,🇭🇷,🇨🇺,🇨🇼,🇨🇾,🇨🇿,🇩🇰,🇩🇯,🇩🇲,🇩🇴,🇪🇨,🇪🇬,🇸🇻,🇬🇶,🇪🇷,🇪🇪,🇪🇹,🇪🇺,🇫🇰,🇫🇴,🇫🇯,🇫🇮,🇫🇷,🇬🇫,🇵🇫,🇹🇫,🇬🇦,🇬🇲,🇬🇪,🇩🇪,🇬🇭,🇬🇮,🇬🇷,🇬🇱,🇬🇩,🇬🇵,🇬🇺,🇬🇹,🇬🇬,🇬🇳,🇬🇼,🇬🇾,🇭🇹,🇭🇳,🇭🇰,🇭🇺,🇮🇸,🇮🇳,🇮🇩,🇮🇷,🇮🇶,🇮🇪,🇮🇲,🇮🇱,🇮🇹,🇯🇲,🇯🇵,🎌,🇯🇪,🇯🇴,🇰🇿,🇰🇪,🇰🇮,🇽🇰,🇰🇼,🇰🇬,🇱🇦,🇱🇻,🇱🇧,🇱🇸,🇱🇷,🇱🇾,🇱🇮,🇱🇹,🇱🇺,🇲🇴,🇲🇰,🇲🇬,🇲🇼,🇲🇾,🇲🇻,🇲🇱,🇲🇹,🇲🇭,🇲🇶,🇲🇷,🇲🇺,🇾🇹,🇲🇽,🇫🇲,🇲🇩,🇲🇨,🇲🇳,🇲🇪,🇲🇸,🇲🇦,🇲🇿,🇲🇲,🇳🇦,🇳🇷,🇳🇵,🇳🇱,🇳🇨,🇳🇿,🇳🇮,🇳🇪,🇳🇬,🇳🇺,🇳🇫,🇲🇵,🇰🇵,🇳🇴,🇴🇲,🇵🇰,🇵🇼,🇵🇸,🇵🇦,🇵🇬,🇵🇾,🇵🇪,🇵🇭,🇵🇳,🇵🇱,🇵🇹,🇵🇷,🇶🇦,🇷🇪,🇷🇴,🇷🇺,🇷🇼,🇧🇱,🇸🇭,🇰🇳,🇱🇨,🇵🇲,🇻🇨,🇼🇸,🇸🇲,🇸🇹,🇸🇦,🇸🇳,🇷🇸,🇸🇨,🇸🇱,🇸🇬,🇸🇽,🇸🇰,🇸🇮,🇸🇧,🇸🇴,🇿🇦,🇬🇸,🇰🇷,🇸🇸,🇪🇸,🇱🇰,🇸🇩,🇸🇷,🇸🇿,🇸🇪,🇨🇭,🇸🇾,🇹🇼,🇹🇯,🇹🇿,🇹🇭,🇹🇱,🇹🇬,🇹🇰,🇹🇴,🇹🇹,🇹🇳,🇹🇷,🇹🇲,🇹🇨,🇹🇻,🇺🇬,🇺🇦,🇦🇪,🇬🇧,🇺🇸,🇻🇮,🇺🇾,🇺🇿,🇻🇺,🇻🇦,🇻🇪,🇻🇳,🇼🇫,🇪🇭,🇾🇪,🇿🇲,🇿🇼"
}
}
],

View File

@@ -11,71 +11,76 @@
<textarea id="output" rows="50" cols="80"></textarea>
<script>
const VARIATION_SELECTOR_15 = String.fromCharCode(0xfe0e);
const VARIATION_SELECTOR_16 = String.fromCharCode(0xfe0f);
const EMOJI_SIZE = 32
const VARIATION_SELECTOR_16 = /\ufe0f$/
function detectAliases(db) {
for (var i = 0; i < db.length; ++i) {
var emoji = db[i];
var raw = emoji.emoji;
if (!raw) {
continue;
}
const canvas = document.createElement('canvas')
if (raw.indexOf(VARIATION_SELECTOR_16) > -1) {
var candidates = [raw.replace(VARIATION_SELECTOR_16, ""), raw];
for (const emoji of db) {
const raw = emoji.emoji
if (!raw) continue
const candidates = [raw]
if (VARIATION_SELECTOR_16.test(raw)) {
candidates.unshift(raw.replace(VARIATION_SELECTOR_16, ''))
} else {
var candidates = [raw, raw + VARIATION_SELECTOR_16];
candidates.push(`${raw}\u{fe0f}`)
}
var aliases = candidates.filter(isColorEmoji);
emoji.emoji = aliases[0];
}
const newRaw = candidates.filter(e => detectEmoji(canvas, e))[0]
dump(db);
}
function isColorEmoji(candidate) {
// Draw the emoji twice using a different color each time. If the emoji
// draws as the same color regardless of what color we set, it's a color
// emoji.
return color(candidate, "#f00") === color(candidate, "#0f0");
}
var canvas = document.createElement("canvas");
canvas.width = canvas.height = EMOJI_SIZE;
function color(emoji, rgb) {
var context = canvas.getContext("2d");
context.clearRect(0, 0, canvas.width, canvas.height);
context.fillStyle = rgb;
context.textBaseline = "top";
context.font = EMOJI_SIZE+"px Arial";
context.fillText(emoji, 0, 0);
var data = context.getImageData(0, 0, EMOJI_SIZE, EMOJI_SIZE).data;
for (var i = 0; i < data.length; i += 4) {
if (data[i] === 0 && data[i + 1] === 0 && data[i + 2] === 0) {
continue;
if (newRaw && newRaw != raw) {
emoji.emoji = newRaw
console.info('new raw representation found for %s :%s:', raw, emoji.aliases[0])
}
if (!newRaw) {
console.warn('no raw representation for %s :%s:', raw, emoji.aliases[0])
}
return data[i].toString(16)
+ data[i + 1].toString(16)
+ data[i + 2].toString(16);
}
return "no colored pixel found";
dump(db)
}
function detectEmoji(canvas, emoji) {
const context = canvas.getContext('2d')
drawEmoji(context, emoji)
let supported = false
const data = context.getImageData(0, 16, 64, 1).data
for (let x = 0; x <= 64; x++) {
if (x <= 32) {
// character is supported if there are any colored pixels found
if (data[4*x] || data[4*x + 1] || data[4*x + 2]) supported = true
} else if (x >= 48 && data[4*x + 3] > 0) {
// however, if more than one character got rendered, treat as unsupported
supported = false
break
}
}
return supported
}
function drawEmoji(context, emoji) {
context.clearRect(0, 0, 400, 400)
context.fillStyle = '#000'
context.textBaseline = 'top'
context.font = '32px sans-serif, "Apple Color Emoji", "Segoe UI", "Segoe UI Emoji", "Segoe UI Symbol"'
context.fillText(emoji+'___', 0, 0)
}
function dump(db) {
var json = JSON.stringify(db, null, " ")
var json = JSON.stringify(db, null, ' ')
.replace(/^( +)(.+)\[\](,?)$/mg, "$1$2[\n$1]$3")
.replace(/,\n( *) /g, "\n$1, ");
document.getElementById("output").value = json + "\n";
.replace(/,\n( *) /g, "\n$1, ")
document.getElementById('output').value = `${json}\n`
}
var xhr = new XMLHttpRequest;
var xhr = new XMLHttpRequest
xhr.onload = function() {
detectAliases(JSON.parse(this.responseText));
detectAliases(JSON.parse(xhr.responseText))
};
xhr.open("GET", "emoji.json", false);
xhr.send(null);
xhr.open('GET', 'emoji.json', false)
xhr.send(null)
</script>

View File

@@ -1,28 +1,57 @@
require 'emoji'
require 'json'
names_list = File.expand_path('../NamesList.txt', __FILE__)
require 'rexml/document'
class UnicodeCharacter
attr_reader :code, :description, :aliases
attr_reader :code, :description, :version, :aliases
@index = {}
class << self
attr_reader :index
class CharListener
CHAR_TAG = "char".freeze
def fetch(code, *args, &block)
code = code.to_s(16).rjust(4, '0') if code.is_a?(Integer)
index.fetch(code, *args, &block)
def self.parse(io, &block)
REXML::Document.parse_stream(io, self.new(&block))
end
def initialize(&block)
@callback = block
end
def tag_start(name, attributes)
if CHAR_TAG == name
@callback.call(
attributes.fetch("cp") { return },
attributes.fetch("na") { return },
attributes.fetch("age", nil),
)
end
end
def method_missing(*) end
end
def initialize(code, description)
def self.index
return @index if defined? @index
@index = {}
File.open(File.expand_path('../ucd.nounihan.grouped.xml', __FILE__)) do |source|
CharListener.parse(source) do |char, desc, age|
uc = UnicodeCharacter.new(char, desc, age)
@index[uc.code] = uc
end
end
@index
end
def self.fetch(code)
code = code.to_s(16).rjust(4, '0') if code.is_a?(Integer)
self.index.fetch(code)
end
def initialize(code, description, version)
@code = code.downcase
@description = description.downcase
@version = version
@aliases = []
@references = []
self.class.index[@code] = self
end
def add_alias(string)
@@ -34,39 +63,74 @@ class UnicodeCharacter
end
end
char = nil
File.foreach(names_list) do |line|
case line
when /^[A-F0-9]{4,5}\t/
code, desc = line.chomp.split("\t", 2)
codepoint = code.hex
char = UnicodeCharacter.new(code, desc)
when /^\t= /
char.add_alias($')
when /^\tx .+ - ([A-F0-9]{4,5})\)$/
char.add_reference($1)
unless $stdin.tty?
codepoints = STDIN.read.chomp.codepoints.map { |code|
UnicodeCharacter.fetch(code)
}
codepoints.each do |char|
printf "%5s: %s", char.code.upcase, char.description
printf " (%s)", char.version if char.version
puts
end
exit
end
trap(:PIPE) { abort }
items = []
variation_codepoint = Emoji::VARIATION_SELECTOR_16.codepoints[0]
normalize = -> (raw) {
raw.sub(Emoji::VARIATION_SELECTOR_16, '')
}
for emoji in Emoji.all
item = {}
unless emoji.custom?
chars = emoji.raw.codepoints.map { |code| UnicodeCharacter.fetch(code) unless code == variation_codepoint }.compact
item[:emoji] = emoji.raw
item[:description] = chars.map(&:description).join(' + ')
emojidesc = {}
File.open(File.expand_path('../emoji-test.txt', __FILE__)) do |file|
file.each do |line|
next if line =~ /^(#|$)/
line = line.chomp.split('# ', 2)[1]
emoji, description = line.split(' ', 2)
emojidesc[normalize.(emoji)] = description
end
end
item[:aliases] = emoji.aliases
item[:tags] = emoji.tags
items = []
items << item
for category, emojis in Emoji.apple_palette
for raw in emojis
emoji = Emoji.find_by_unicode(raw)
unicode_version = emoji ? emoji.unicode_version : ''
ios_version = emoji ? emoji.ios_version : ''
unless raw.include?(Emoji::ZERO_WIDTH_JOINER)
uchar = UnicodeCharacter.fetch(raw.codepoints[0])
unicode_version = uchar.version unless uchar.version.nil?
end
description = emojidesc.fetch(normalize.(raw))
if unicode_version == ''
warn "#{description} (#{raw}) doesn't have Unicode version"
end
if ios_version == ''
ios_version = '10.2'
end
items << {
emoji: raw,
description: description,
category: category,
aliases: emoji ? emoji.aliases : [description.gsub(/\W+/, '_').downcase],
tags: emoji ? emoji.tags : [],
unicode_version: unicode_version,
ios_version: ios_version,
}
end
end
for emoji in Emoji.all.select(&:custom?)
items << {
aliases: emoji.aliases,
tags: emoji.tags,
}
end
puts JSON.pretty_generate(items)

View File

File diff suppressed because it is too large Load Diff

View File

@@ -66,7 +66,7 @@ li > span {
if (emoji.emoji) els[0].textContent = emoji.emoji
else {
var img = document.createElement('img')
img.src = "../images/emoji/" + emoji.aliases[0] + ".png"
img.src = "../images/" + emoji.aliases[0] + ".png"
els[0].appendChild(img)
}
els[1].textContent = emoji.description || ''

View File

@@ -1,8 +1,9 @@
Gem::Specification.new do |s|
s.name = "gemoji"
s.version = "2.1.0"
s.summary = "Emoji conversion and image assets"
s.description = "Image assets and character information for emoji."
s.version = "3.0.1"
s.summary = "Emoji library"
s.description = "Character information and metadata for standard and custom emoji."
s.executables = ["gemoji"]
s.required_ruby_version = '> 1.9'
@@ -13,9 +14,10 @@ Gem::Specification.new do |s|
s.files = Dir[
"README.md",
"images/**/*.png",
"bin/gemoji",
"images/*.png",
"db/Category-Emoji.json",
"db/emoji.json",
"lib/**/*.rb",
"lib/tasks/*.rake"
]
end

BIN
images/basecamp.png Normal file
View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 898 B

BIN
images/basecampy.png Normal file
View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

BIN
images/bowtie.png Normal file
View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.1 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1016 B

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

Some files were not shown because too many files have changed in this diff Show More