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

Add Microsoft Fluent Emoji #232

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule "build/twitter/twemoji"]
path = build/twitter/twemoji
url = https://github.com/twitter/twemoji.git
[submodule "build/microsoft/fluent-emoji"]
path = build/microsoft/fluent-emoji
url = https://github.com/microsoft/fluentui-emoji.git
44 changes: 25 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ npm install emoji-datasource-apple
npm install emoji-datasource-google
npm install emoji-datasource-twitter
npm install emoji-datasource-facebook
npm install emoji-datasource-microsoft
```

You can also use it without downloading via [jsDelivr CDN](https://www.jsdelivr.com/package/npm/emoji-datasource?path=img)
Expand All @@ -47,9 +48,9 @@ look like this:
"au": "E4F6",
"softbank": "E00F",
"google": "FEB98",
"image": "261d.png",
"sheet_x": 1,
"sheet_y": 2,
"image": "261d-fe0f.png",
"sheet_x": 57,
"sheet_y": 20,
"short_name": "point_up",
"short_names": [
"point_up"
Expand All @@ -58,24 +59,27 @@ look like this:
"texts": null,
"category": "People & Body",
"subcategory": "hand-single-finger",
"sort_order": 170,
"added_in": "1.4",
"sort_order": 192,
"added_in": "0.6",
"has_img_apple": true,
"has_img_google": true,
"has_img_twitter": true,
"has_img_facebook": false,
"has_img_facebook": true,
"has_img_microsoft": true,
"skin_variations": {
"1F3FB": {
"unified": "261D-1F3FB",
"non_qualified": null,
"image": "261d-1f3fb.png",
"sheet_x": 1,
"sheet_y": 3,
"added_in": "6.0",
"sheet_x": 57,
"sheet_y": 21,
"added_in": "1.0",
"has_img_apple": true,
"has_img_google": false,
"has_img_twitter": false,
"has_img_facebook": false,
}
"has_img_google": true,
"has_img_twitter": true,
"has_img_facebook": true,
"has_img_microsoft": true
},
...
"1F3FB-1F3FC": {
...
Expand Down Expand Up @@ -148,17 +152,19 @@ Images are extracted from their sources and this library attempts to track the l
available versions. If you're looking for older versions of Apple or Android images
(such as the Hairy Heart) then you'll need to look at previous revisions.

| Image Set | Source Version | Supported Emoji | Missing Images |
|-----------|-----------------------------------------------------------------|-----------------|----------------|
| Apple | macOS Ventura 13.3.1 | Emoji 15.0 | 3 |
| Google | [Noto Emoji](https://github.com/googlefonts/noto-emoji), v2.038 | Emoji 15.0 | 0 |
| Twitter | [Twemoji](https://github.com/twitter/twemoji), v14.0.0 | Emoji 14.0 | 31 |
| Facebook | v9, fetched 2023-04-17 | Emoji 14.0 | 55 |
| Image Set | Source Version | Supported Emoji | Missing Images |
| --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------- | -------------- |
| Apple | macOS Ventura 13.3.1 | Emoji 15.0 | 3 |
| Google | [Noto Emoji](https://github.com/googlefonts/noto-emoji), v2.038 | Emoji 15.0 | 0 |
| Twitter | [Twemoji](https://github.com/twitter/twemoji), v14.0.0 | Emoji 14.0 | 31 |
| Facebook | v9, fetched 2023-04-17 | Emoji 14.0 | 55 |
| Microsoft | [fluent-emoji](https://github.com/microsoft/fluentui-emoji), [`dfb5c3b`](https://github.com/microsoft/fluentui-emoji/commit/dfb5c3b7b10e20878a3fee6e3b05660e4d3bd9d5) | No clear version | 650 |

* Apple images, Copyright © Apple Inc., are not licensed for commercial usage.
* Android/Google/Noto images, are available under the [Apache License 2.0](https://github.com/googlei18n/noto-emoji/blob/master/LICENSE).
* Twitter images are available under the [Creative Commons Attribution 4.0 license](https://github.com/twitter/twemoji/blob/gh-pages/LICENSE-GRAPHICS).
* Facebook images, © Facebook, Inc., have no clear licensing.
* Microsoft images are available under the [MIT License](https://github.com/microsoft/fluentui-emoji/blob/main/LICENSE).

If you use the spritesheet images and are concerned about usage rights, please use the 'clean' versions, which avoid using fallback images for
missing emoji (see the spritesheet section above for more details).
Expand Down
3 changes: 2 additions & 1 deletion build/build_image.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
create_sheet('twitter', $sz, $clean);
create_sheet('google', $sz, $clean);
create_sheet('facebook', $sz, $clean);
create_sheet('microsoft', $sz, $clean);
}
}

Expand All @@ -66,7 +67,7 @@ function create_sheet($type, $img_w, $clean){
if ($clean){
$try_order = array($type);
}else{
$try_order = array($type, 'apple', 'google', 'twitter', 'facebook');
$try_order = array($type, 'apple', 'google', 'twitter', 'facebook', 'microsoft');
}


Expand Down
2 changes: 2 additions & 0 deletions build/build_map.php
Original file line number Diff line number Diff line change
Expand Up @@ -819,6 +819,7 @@ function simple_row($img_key, $shorts, $props){
$ret['has_img_google'] = file_exists("{$GLOBALS['dir']}/../img-google-64/{$ret['image']}");
$ret['has_img_twitter'] = file_exists("{$GLOBALS['dir']}/../img-twitter-64/{$ret['image']}");
$ret['has_img_facebook'] = file_exists("{$GLOBALS['dir']}/../img-facebook-64/{$ret['image']}");
$ret['has_img_microsoft'] = file_exists("{$GLOBALS['dir']}/../img-microsoft-64/{$ret['image']}");

foreach ($props as $k => $v) $ret[$k] = $v;

Expand Down Expand Up @@ -862,6 +863,7 @@ function simple_row($img_key, $shorts, $props){
'has_img_google' => file_exists("{$GLOBALS['dir']}/../img-google-64/{$var_img}"),
'has_img_twitter' => file_exists("{$GLOBALS['dir']}/../img-twitter-64/{$var_img}"),
'has_img_facebook' => file_exists("{$GLOBALS['dir']}/../img-facebook-64/{$var_img}"),
'has_img_microsoft' => file_exists("{$GLOBALS['dir']}/../img-facebook-64/{$var_img}"),
);

$ret['skin_variations'][$suffix] = $variation;
Expand Down
230 changes: 118 additions & 112 deletions build/build_table.php
Original file line number Diff line number Diff line change
@@ -1,140 +1,146 @@
<?php
$in = file_get_contents('../emoji.json');
$catalog = json_decode($in, true);
$in = file_get_contents('../emoji.json');
$catalog = json_decode($in, true);

function format_codepoints($raw){
function format_codepoints($raw)
{

if (!$raw) return '-';
if (!$raw)
return '-';

$out = array();
$out = array();

foreach (explode('-', $raw) as $u){
$out[] = "U+$u";
}

return implode(' ', $out);
foreach (explode('-', $raw) as $u) {
$out[] = "U+$u";
}

function unicode_bytes($uni){
return implode(' ', $out);
}

$out = '';
function unicode_bytes($uni)
{

$cps = explode('-', $uni);
foreach ($cps as $cp){
$out .= emoji_utf8_bytes(hexdec($cp));
}
$out = '';

return $out;
$cps = explode('-', $uni);
foreach ($cps as $cp) {
$out .= emoji_utf8_bytes(hexdec($cp));
}

function emoji_utf8_bytes($cp){

if ($cp > 0x10000){
# 4 bytes
return chr(0xF0 | (($cp & 0x1C0000) >> 18)).
chr(0x80 | (($cp & 0x3F000) >> 12)).
chr(0x80 | (($cp & 0xFC0) >> 6)).
chr(0x80 | ($cp & 0x3F));
}else if ($cp > 0x800){
# 3 bytes
return chr(0xE0 | (($cp & 0xF000) >> 12)).
chr(0x80 | (($cp & 0xFC0) >> 6)).
chr(0x80 | ($cp & 0x3F));
}else if ($cp > 0x80){
# 2 bytes
return chr(0xC0 | (($cp & 0x7C0) >> 6)).
chr(0x80 | ($cp & 0x3F));
}else{
# 1 byte
return chr($cp);
}
return $out;
}

function emoji_utf8_bytes($cp)
{

if ($cp > 0x10000) {
# 4 bytes
return chr(0xF0 | (($cp & 0x1C0000) >> 18)) .
chr(0x80 | (($cp & 0x3F000) >> 12)) .
chr(0x80 | (($cp & 0xFC0) >> 6)) .
chr(0x80 | ($cp & 0x3F));
} else if ($cp > 0x800) {
# 3 bytes
return chr(0xE0 | (($cp & 0xF000) >> 12)) .
chr(0x80 | (($cp & 0xFC0) >> 6)) .
chr(0x80 | ($cp & 0x3F));
} else if ($cp > 0x80) {
# 2 bytes
return chr(0xC0 | (($cp & 0x7C0) >> 6)) .
chr(0x80 | ($cp & 0x3F));
} else {
# 1 byte
return chr($cp);
}
}

?>
<html>
<head>
<meta charset="UTF-8" />
<title>Emoji Catalog</title>
<link rel="stylesheet" type="text/css" media="all" href="emoji.css" />
<style type="text/css">

body {
font-size: 12px;
font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
}

table {
border-radius: 0.41em;
border: 1px solid #999;
font-size: 12px;
}
<head>
<meta charset="UTF-8" />
<title>Emoji Catalog</title>
<link rel="stylesheet" type="text/css" media="all" href="emoji.css" />
<style type="text/css">
body {
font-size: 12px;
font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
}

table td {
padding-left: 0.41em;
padding-right: 0.41em;
}
table {
border-radius: 0.41em;
border: 1px solid #999;
font-size: 12px;
}

table th {
font-weight: bold;
text-align: left;
background: #BBB;
color: #333;
font-size: 14px;
padding: 0.41em;
}
table td {
padding-left: 0.41em;
padding-right: 0.41em;
}

table tbody tr:nth-child(even) {
background: #dedede;
}
table th {
font-weight: bold;
text-align: left;
background: #BBB;
color: #333;
font-size: 14px;
padding: 0.41em;
}

table tbody td {
padding: 0.41em;
}
table tbody tr:nth-child(even) {
background: #dedede;
}

</style>
table tbody td {
padding: 0.41em;
}
</style>
</head>
<body>

<h1>Emoji Catalog</h1>

<table cellspacing="0" cellpadding="0">
<tr>
<th colspan="5">Images</th>
<th>Official Name</th>
<th>Short Name</th>
<th>Code Point(s)</th>
<th>Image Path</th>
<th>Sheet</th>
</tr>
<tbody>

<?php
function image_cell($has, $url){
if ($has){
echo "\t\t<td><img src=\"{$url}\" width=\"20\" height=\"20\" /></td>\n";
}else{
echo "\t\t<td style=\"text-align: center\">-</td>\n";
}
}
<body>

foreach ($catalog as $row){

echo "\t<tr>\n";
image_cell($row['has_img_apple' ], "img-apple-64/{$row['image']}");
image_cell($row['has_img_google' ], "img-google-64/{$row['image']}");
image_cell($row['has_img_twitter' ], "img-twitter-64/{$row['image']}");
image_cell($row['has_img_facebook' ], "img-facebook-64/{$row['image']}");
echo "\t\t<td>".unicode_bytes($row['unified'])."</td>\n";
echo "\t\t<td>".HtmlSpecialChars(mb_strtolower($row['name'], 'UTF-8'))."</td>\n";
echo "\t\t<td>:{$row['short_name']}:</td>\n";
echo "\t\t<td>".format_codepoints($row['unified'])."</td>\n";
echo "\t\t<td>{$row['image']}</td>\n";
echo "\t\t<td>{$row['sheet_x']},{$row['sheet_y']}</td>\n";
echo "\t</tr>\n";
}
?>
</tbody>
</table>
<h1>Emoji Catalog</h1>

<table cellspacing="0" cellpadding="0">
<tr>
<th colspan="5">Images</th>
<th>Official Name</th>
<th>Short Name</th>
<th>Code Point(s)</th>
<th>Image Path</th>
<th>Sheet</th>
</tr>
<tbody>

<?php
function image_cell($has, $url)
{
if ($has) {
echo "\t\t<td><img src=\"{$url}\" width=\"20\" height=\"20\" /></td>\n";
} else {
echo "\t\t<td style=\"text-align: center\">-</td>\n";
}
}

foreach ($catalog as $row) {

echo "\t<tr>\n";
image_cell($row['has_img_apple'], "img-apple-64/{$row['image']}");
image_cell($row['has_img_google'], "img-google-64/{$row['image']}");
image_cell($row['has_img_twitter'], "img-twitter-64/{$row['image']}");
image_cell($row['has_img_facebook'], "img-facebook-64/{$row['image']}");
image_cell($row['has_img_microsoft'], "img-microsoft-64/{$row['image']}");
echo "\t\t<td>" . unicode_bytes($row['unified']) . "</td>\n";
echo "\t\t<td>" . HtmlSpecialChars(mb_strtolower($row['name'], 'UTF-8')) . "</td>\n";
echo "\t\t<td>:{$row['short_name']}:</td>\n";
echo "\t\t<td>" . format_codepoints($row['unified']) . "</td>\n";
echo "\t\t<td>{$row['image']}</td>\n";
echo "\t\t<td>{$row['sheet_x']},{$row['sheet_y']}</td>\n";
echo "\t</tr>\n";
}
?>
</tbody>
</table>

</body>
<html>
3 changes: 2 additions & 1 deletion build/find_flags.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
$b = find_flags("../img-google-64/1f1*-1f1*.png");
$c = find_flags("../img-twitter-64/1f1*-1f1*.png");
$d = find_flags("../img-facebook-64/1f1*-1f1*.png");
$e = find_flags("../img-microsoft-64/1f1*-1f1*.png");

$all = array_unique(array_merge($a, $b, $c, $d));
$all = array_unique(array_merge($a, $b, $c, $d, $e));
sort($all);

foreach ($all as $line) echo $line;
Expand Down
Loading