Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8d7c6fa4e3 | ||
|
|
21c4e27ee2 | ||
|
|
aed88bb347 | ||
|
|
b04991b001 | ||
|
|
8d6aff3fc6 | ||
|
|
3f6057146c | ||
|
|
61e16ae891 | ||
|
|
9b8ad85de0 | ||
|
|
09125ab983 | ||
|
|
b9ce241bf1 | ||
|
|
ed954928d7 | ||
|
|
7858e79566 | ||
|
|
7bdd3f657f | ||
|
|
68af9e3320 |
@@ -1,3 +1,5 @@
|
||||
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
|
||||
|
||||
|
||||
105
db/aliases.html
105
db/aliases.html
@@ -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>
|
||||
|
||||
103
db/emoji.json
103
db/emoji.json
@@ -38,6 +38,7 @@
|
||||
, "tags": [
|
||||
"happy"
|
||||
, "joy"
|
||||
, "laugh"
|
||||
, "pleased"
|
||||
]
|
||||
, "unicode_version": "6.0"
|
||||
@@ -1912,7 +1913,7 @@
|
||||
, "ios_version": "6.0"
|
||||
}
|
||||
, {
|
||||
"emoji": "👱♀️"
|
||||
"emoji": "👱♀"
|
||||
, "description": "blond-haired woman"
|
||||
, "category": "People"
|
||||
, "aliases": [
|
||||
@@ -1974,7 +1975,7 @@
|
||||
, "ios_version": "6.0"
|
||||
}
|
||||
, {
|
||||
"emoji": "👳♀️"
|
||||
"emoji": "👳♀"
|
||||
, "description": "woman wearing turban"
|
||||
, "category": "People"
|
||||
, "aliases": [
|
||||
@@ -1998,13 +1999,16 @@
|
||||
, "ios_version": "6.0"
|
||||
}
|
||||
, {
|
||||
"emoji": "👮♀️"
|
||||
"emoji": "👮♀"
|
||||
, "description": "woman police officer"
|
||||
, "category": "People"
|
||||
, "aliases": [
|
||||
"policewoman"
|
||||
]
|
||||
, "tags": [
|
||||
"police"
|
||||
, "law"
|
||||
, "cop"
|
||||
]
|
||||
, "unicode_version": "6.0"
|
||||
, "ios_version": "10.0"
|
||||
@@ -2025,7 +2029,7 @@
|
||||
, "ios_version": "6.0"
|
||||
}
|
||||
, {
|
||||
"emoji": "👷♀️"
|
||||
"emoji": "👷♀"
|
||||
, "description": "woman construction worker"
|
||||
, "category": "People"
|
||||
, "aliases": [
|
||||
@@ -2051,7 +2055,7 @@
|
||||
, "ios_version": "6.0"
|
||||
}
|
||||
, {
|
||||
"emoji": "💂♀️"
|
||||
"emoji": "💂♀"
|
||||
, "description": "woman guard"
|
||||
, "category": "People"
|
||||
, "aliases": [
|
||||
@@ -2088,7 +2092,7 @@
|
||||
, "ios_version": "10.0"
|
||||
}
|
||||
, {
|
||||
"emoji": "🕵️"
|
||||
"emoji": "🕵"
|
||||
, "description": "detective"
|
||||
, "category": "People"
|
||||
, "aliases": [
|
||||
@@ -2102,7 +2106,7 @@
|
||||
, "ios_version": "9.1"
|
||||
}
|
||||
, {
|
||||
"emoji": "👩⚕️"
|
||||
"emoji": "👩⚕"
|
||||
, "description": "woman health worker"
|
||||
, "category": "People"
|
||||
, "aliases": [
|
||||
@@ -2116,7 +2120,7 @@
|
||||
, "ios_version": "10.2"
|
||||
}
|
||||
, {
|
||||
"emoji": "👨⚕️"
|
||||
"emoji": "👨⚕"
|
||||
, "description": "man health worker"
|
||||
, "category": "People"
|
||||
, "aliases": [
|
||||
@@ -2436,7 +2440,7 @@
|
||||
, "ios_version": "10.2"
|
||||
}
|
||||
, {
|
||||
"emoji": "👩✈️"
|
||||
"emoji": "👩✈"
|
||||
, "description": "woman pilot"
|
||||
, "category": "People"
|
||||
, "aliases": [
|
||||
@@ -2448,7 +2452,7 @@
|
||||
, "ios_version": "10.2"
|
||||
}
|
||||
, {
|
||||
"emoji": "👨✈️"
|
||||
"emoji": "👨✈"
|
||||
, "description": "man pilot"
|
||||
, "category": "People"
|
||||
, "aliases": [
|
||||
@@ -2486,7 +2490,7 @@
|
||||
, "ios_version": "10.2"
|
||||
}
|
||||
, {
|
||||
"emoji": "👩⚖️"
|
||||
"emoji": "👩⚖"
|
||||
, "description": "woman judge"
|
||||
, "category": "People"
|
||||
, "aliases": [
|
||||
@@ -2499,7 +2503,7 @@
|
||||
, "ios_version": "10.2"
|
||||
}
|
||||
, {
|
||||
"emoji": "👨⚖️"
|
||||
"emoji": "👨⚖"
|
||||
, "description": "man judge"
|
||||
, "category": "People"
|
||||
, "aliases": [
|
||||
@@ -2620,7 +2624,7 @@
|
||||
, "ios_version": "10.2"
|
||||
}
|
||||
, {
|
||||
"emoji": "🙇♀️"
|
||||
"emoji": "🙇♀"
|
||||
, "description": "woman bowing"
|
||||
, "category": "People"
|
||||
, "aliases": [
|
||||
@@ -2655,6 +2659,7 @@
|
||||
, "aliases": [
|
||||
"tipping_hand_woman"
|
||||
, "information_desk_person"
|
||||
, "sassy_woman"
|
||||
]
|
||||
, "tags": [
|
||||
]
|
||||
@@ -2662,11 +2667,12 @@
|
||||
, "ios_version": "6.0"
|
||||
}
|
||||
, {
|
||||
"emoji": "💁♂️"
|
||||
"emoji": "💁♂"
|
||||
, "description": "man tipping hand"
|
||||
, "category": "People"
|
||||
, "aliases": [
|
||||
"tipping_hand_man"
|
||||
, "sassy_man"
|
||||
]
|
||||
, "tags": [
|
||||
"information"
|
||||
@@ -2691,7 +2697,7 @@
|
||||
, "ios_version": "6.0"
|
||||
}
|
||||
, {
|
||||
"emoji": "🙅♂️"
|
||||
"emoji": "🙅♂"
|
||||
, "description": "man gesturing NO"
|
||||
, "category": "People"
|
||||
, "aliases": [
|
||||
@@ -2718,7 +2724,7 @@
|
||||
, "ios_version": "6.0"
|
||||
}
|
||||
, {
|
||||
"emoji": "🙆♂️"
|
||||
"emoji": "🙆♂"
|
||||
, "description": "man gesturing OK"
|
||||
, "category": "People"
|
||||
, "aliases": [
|
||||
@@ -2743,7 +2749,7 @@
|
||||
, "ios_version": "6.0"
|
||||
}
|
||||
, {
|
||||
"emoji": "🙋♂️"
|
||||
"emoji": "🙋♂"
|
||||
, "description": "man raising hand"
|
||||
, "category": "People"
|
||||
, "aliases": [
|
||||
@@ -2755,7 +2761,7 @@
|
||||
, "ios_version": "10.0"
|
||||
}
|
||||
, {
|
||||
"emoji": "🤦♀️"
|
||||
"emoji": "🤦♀"
|
||||
, "description": "woman facepalming"
|
||||
, "category": "People"
|
||||
, "aliases": [
|
||||
@@ -2767,7 +2773,7 @@
|
||||
, "ios_version": "10.2"
|
||||
}
|
||||
, {
|
||||
"emoji": "🤦♂️"
|
||||
"emoji": "🤦♂"
|
||||
, "description": "man facepalming"
|
||||
, "category": "People"
|
||||
, "aliases": [
|
||||
@@ -2779,7 +2785,7 @@
|
||||
, "ios_version": "10.2"
|
||||
}
|
||||
, {
|
||||
"emoji": "🤷♀️"
|
||||
"emoji": "🤷♀"
|
||||
, "description": "woman shrugging"
|
||||
, "category": "People"
|
||||
, "aliases": [
|
||||
@@ -2791,7 +2797,7 @@
|
||||
, "ios_version": "10.2"
|
||||
}
|
||||
, {
|
||||
"emoji": "🤷♂️"
|
||||
"emoji": "🤷♂"
|
||||
, "description": "man shrugging"
|
||||
, "category": "People"
|
||||
, "aliases": [
|
||||
@@ -2816,7 +2822,7 @@
|
||||
, "ios_version": "6.0"
|
||||
}
|
||||
, {
|
||||
"emoji": "🙎♂️"
|
||||
"emoji": "🙎♂"
|
||||
, "description": "man pouting"
|
||||
, "category": "People"
|
||||
, "aliases": [
|
||||
@@ -2842,7 +2848,7 @@
|
||||
, "ios_version": "6.0"
|
||||
}
|
||||
, {
|
||||
"emoji": "🙍♂️"
|
||||
"emoji": "🙍♂"
|
||||
, "description": "man frowning"
|
||||
, "category": "People"
|
||||
, "aliases": [
|
||||
@@ -2868,7 +2874,7 @@
|
||||
, "ios_version": "6.0"
|
||||
}
|
||||
, {
|
||||
"emoji": "💇♂️"
|
||||
"emoji": "💇♂"
|
||||
, "description": "man getting haircut"
|
||||
, "category": "People"
|
||||
, "aliases": [
|
||||
@@ -2894,7 +2900,7 @@
|
||||
, "ios_version": "6.0"
|
||||
}
|
||||
, {
|
||||
"emoji": "💆♂️"
|
||||
"emoji": "💆♂"
|
||||
, "description": "man getting massage"
|
||||
, "category": "People"
|
||||
, "aliases": [
|
||||
@@ -2959,7 +2965,7 @@
|
||||
, "ios_version": "6.0"
|
||||
}
|
||||
, {
|
||||
"emoji": "👯♂️"
|
||||
"emoji": "👯♂"
|
||||
, "description": "men with bunny ears partying"
|
||||
, "category": "People"
|
||||
, "aliases": [
|
||||
@@ -2972,7 +2978,7 @@
|
||||
, "ios_version": "10.0"
|
||||
}
|
||||
, {
|
||||
"emoji": "🚶♀️"
|
||||
"emoji": "🚶♀"
|
||||
, "description": "woman walking"
|
||||
, "category": "People"
|
||||
, "aliases": [
|
||||
@@ -2997,7 +3003,7 @@
|
||||
, "ios_version": "6.0"
|
||||
}
|
||||
, {
|
||||
"emoji": "🏃♀️"
|
||||
"emoji": "🏃♀"
|
||||
, "description": "woman running"
|
||||
, "category": "People"
|
||||
, "aliases": [
|
||||
@@ -5474,7 +5480,7 @@
|
||||
, "ios_version": "6.0"
|
||||
}
|
||||
, {
|
||||
"emoji": "☄️"
|
||||
"emoji": "☄"
|
||||
, "description": "comet"
|
||||
, "category": "Nature"
|
||||
, "aliases": [
|
||||
@@ -7139,7 +7145,7 @@
|
||||
, "ios_version": "10.0"
|
||||
}
|
||||
, {
|
||||
"emoji": "🏋️"
|
||||
"emoji": "🏋"
|
||||
, "description": "person lifting weights"
|
||||
, "category": "Activity"
|
||||
, "aliases": [
|
||||
@@ -7165,7 +7171,7 @@
|
||||
, "ios_version": "10.2"
|
||||
}
|
||||
, {
|
||||
"emoji": "🤼♀️"
|
||||
"emoji": "🤼♀"
|
||||
, "description": "women wrestling"
|
||||
, "category": "Activity"
|
||||
, "aliases": [
|
||||
@@ -7177,7 +7183,7 @@
|
||||
, "ios_version": "10.2"
|
||||
}
|
||||
, {
|
||||
"emoji": "🤼♂️"
|
||||
"emoji": "🤼♂"
|
||||
, "description": "men wrestling"
|
||||
, "category": "Activity"
|
||||
, "aliases": [
|
||||
@@ -7189,7 +7195,7 @@
|
||||
, "ios_version": "10.2"
|
||||
}
|
||||
, {
|
||||
"emoji": "🤸♀️"
|
||||
"emoji": "🤸♀"
|
||||
, "description": "woman cartwheeling"
|
||||
, "category": "Activity"
|
||||
, "aliases": [
|
||||
@@ -7201,7 +7207,7 @@
|
||||
, "ios_version": "10.2"
|
||||
}
|
||||
, {
|
||||
"emoji": "🤸♂️"
|
||||
"emoji": "🤸♂"
|
||||
, "description": "man cartwheeling"
|
||||
, "category": "Activity"
|
||||
, "aliases": [
|
||||
@@ -7225,7 +7231,7 @@
|
||||
, "ios_version": "10.0"
|
||||
}
|
||||
, {
|
||||
"emoji": "⛹️"
|
||||
"emoji": "⛹"
|
||||
, "description": "person bouncing ball"
|
||||
, "category": "Activity"
|
||||
, "aliases": [
|
||||
@@ -7237,7 +7243,7 @@
|
||||
, "ios_version": "9.1"
|
||||
}
|
||||
, {
|
||||
"emoji": "🤾♀️"
|
||||
"emoji": "🤾♀"
|
||||
, "description": "woman playing handball"
|
||||
, "category": "Activity"
|
||||
, "aliases": [
|
||||
@@ -7249,7 +7255,7 @@
|
||||
, "ios_version": "10.2"
|
||||
}
|
||||
, {
|
||||
"emoji": "🤾♂️"
|
||||
"emoji": "🤾♂"
|
||||
, "description": "man playing handball"
|
||||
, "category": "Activity"
|
||||
, "aliases": [
|
||||
@@ -7273,7 +7279,7 @@
|
||||
, "ios_version": "10.0"
|
||||
}
|
||||
, {
|
||||
"emoji": "🏌️"
|
||||
"emoji": "🏌"
|
||||
, "description": "person golfing"
|
||||
, "category": "Activity"
|
||||
, "aliases": [
|
||||
@@ -7285,7 +7291,7 @@
|
||||
, "ios_version": "9.1"
|
||||
}
|
||||
, {
|
||||
"emoji": "🏄♀️"
|
||||
"emoji": "🏄♀"
|
||||
, "description": "woman surfing"
|
||||
, "category": "Activity"
|
||||
, "aliases": [
|
||||
@@ -7310,7 +7316,7 @@
|
||||
, "ios_version": "6.0"
|
||||
}
|
||||
, {
|
||||
"emoji": "🏊♀️"
|
||||
"emoji": "🏊♀"
|
||||
, "description": "woman swimming"
|
||||
, "category": "Activity"
|
||||
, "aliases": [
|
||||
@@ -7335,7 +7341,7 @@
|
||||
, "ios_version": "6.0"
|
||||
}
|
||||
, {
|
||||
"emoji": "🤽♀️"
|
||||
"emoji": "🤽♀"
|
||||
, "description": "woman playing water polo"
|
||||
, "category": "Activity"
|
||||
, "aliases": [
|
||||
@@ -7347,7 +7353,7 @@
|
||||
, "ios_version": "10.2"
|
||||
}
|
||||
, {
|
||||
"emoji": "🤽♂️"
|
||||
"emoji": "🤽♂"
|
||||
, "description": "man playing water polo"
|
||||
, "category": "Activity"
|
||||
, "aliases": [
|
||||
@@ -7359,7 +7365,7 @@
|
||||
, "ios_version": "10.2"
|
||||
}
|
||||
, {
|
||||
"emoji": "🚣♀️"
|
||||
"emoji": "🚣♀"
|
||||
, "description": "woman rowing boat"
|
||||
, "category": "Activity"
|
||||
, "aliases": [
|
||||
@@ -7396,7 +7402,7 @@
|
||||
, "ios_version": "6.0"
|
||||
}
|
||||
, {
|
||||
"emoji": "🚴♀️"
|
||||
"emoji": "🚴♀"
|
||||
, "description": "woman biking"
|
||||
, "category": "Activity"
|
||||
, "aliases": [
|
||||
@@ -7421,7 +7427,7 @@
|
||||
, "ios_version": "6.0"
|
||||
}
|
||||
, {
|
||||
"emoji": "🚵♀️"
|
||||
"emoji": "🚵♀"
|
||||
, "description": "woman mountain biking"
|
||||
, "category": "Activity"
|
||||
, "aliases": [
|
||||
@@ -7599,7 +7605,7 @@
|
||||
, "ios_version": "6.0"
|
||||
}
|
||||
, {
|
||||
"emoji": "🤹♀️"
|
||||
"emoji": "🤹♀"
|
||||
, "description": "woman juggling"
|
||||
, "category": "Activity"
|
||||
, "aliases": [
|
||||
@@ -7611,7 +7617,7 @@
|
||||
, "ios_version": "10.2"
|
||||
}
|
||||
, {
|
||||
"emoji": "🤹♂️"
|
||||
"emoji": "🤹♂"
|
||||
, "description": "man juggling"
|
||||
, "category": "Activity"
|
||||
, "aliases": [
|
||||
@@ -10591,7 +10597,8 @@
|
||||
"tada"
|
||||
]
|
||||
, "tags": [
|
||||
"party"
|
||||
"hooray"
|
||||
, "party"
|
||||
]
|
||||
, "unicode_version": "6.0"
|
||||
, "ios_version": "6.0"
|
||||
|
||||
@@ -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 || ''
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Gem::Specification.new do |s|
|
||||
s.name = "gemoji"
|
||||
s.version = "3.0.0"
|
||||
s.version = "3.0.1"
|
||||
s.summary = "Emoji library"
|
||||
s.description = "Character information and metadata for standard and custom emoji."
|
||||
s.executables = ["gemoji"]
|
||||
|
||||
Reference in New Issue
Block a user