emacs-emojify icon indicating copy to clipboard operation
emacs-emojify copied to clipboard

Switch to twemoji?

Open drrlvn opened this issue 5 years ago • 10 comments

Since emojione changed their license last year everyone (include emojify) are stuck with version 2.2.6. However, twitter have an alternative under CC-BY 4.0 license that continues to be updated called twemoji.

Maybe emojify should switch to using that?

drrlvn avatar Jan 01 '19 12:01 drrlvn

If you customize emojify-emoji-set, you can select twemoji-v2 or twemoji-v2-22.

feklee avatar Sep 29 '19 13:09 feklee

@drrlvn emojify can now use twemoji, I am planning to make it the default emoji set soon. Thanks @feklee

iqbalansari avatar Oct 17 '19 15:10 iqbalansari

How can you use it with the latest twemoji release? As far as I can tell the releases are only source code, and the gh-pages branch just has versioned directories containing the icons. The only way I could find to download a single release was to do a sparse checkout of the gh-pages branch:

> git clone --filter=blob:none --no-checkout --branch gh-pages https://github.com/twitter/twemoji.git
Cloning into 'twemoji'...
remote: Enumerating objects: 1198, done.
Receiving objects:  98% (1163/1198), 1.57 MiB | 497.00 KiB/sd 1198
Receiving objects: 100% (1198/1198), 1.71 MiB | 508.00 KiB/s, done.
Resolving deltas: 100% (599/599), done.

> cd twemoji

> git sparse-checkout init --cone

> git sparse-checkout set v/13.0.1

> git checkout
remote: Enumerating objects: 403, done.
remote: Counting objects: 100% (403/403), done.
remote: Compressing objects: 100% (294/294), done.
remote: Total 6704 (delta 162), reused 109 (delta 109), pack-reused 6301
Receiving objects: 100% (6704/6704), 4.78 MiB | 1.26 MiB/s, done.
Resolving deltas: 100% (1302/1302), done.
Updating files: 100% (6739/6739), done.
Your branch is up to date with 'origin/gh-pages'.

SamHasler avatar Nov 17 '20 14:11 SamHasler

@SamHasler unfortunately the twemoji cannot be used directly in the project, I need to convert them into a format that can be used by this package, will try and do that next time I work on this. Thanks!

iqbalansari avatar Nov 17 '20 15:11 iqbalansari

Convert the SVG to 24px PNG? Do you have a process for that?

SamHasler avatar Nov 17 '20 16:11 SamHasler

That and also renaming files to the names, emojify expects. I do not have a documented process for it, maybe now is the time to document it.

iqbalansari avatar Nov 17 '20 16:11 iqbalansari

Assuming you have ImageMagick installed, once you have run the above commands to checkout one of the version directories of the twemoji repo and are in it's root directory you can run this to generate the icons:

mkdir 13.0.1/22x22

find 13.0.1/svg -name "*.svg" -execdir sh -c 'magick convert "$1" -background none -density 300 -resize ${2}x${2} -define icon:auto-resize -alpha remove -colors 256 "../${2}x${2}/${1%.svg}.png"' _ {} 22 \;

It takes a long time to run so you might want to run it on a subset first to check it works. e.g. find 13.0.1/svg -name "1f9??.svg" ...

It's based on the answer here. There are also answers using inkscape if you prefer that to ImageMagick (see the answer below the one I linked to for the inkscape width and height parameters which I couldn't find documented anywhere else).

It shouldn't be hard to make a script that takes a version number and then goes and does all the work.

SamHasler avatar Nov 18 '20 06:11 SamHasler

I just realised emacs has SVG support. Could we not just use the twemoji SVGs directly?

SamHasler avatar Nov 18 '20 06:11 SamHasler

once you have cloned the repo you can use this to get a list of versions:

$ git ls-files | cut -d"/" -f1 | uniq
12.0.4
12.1.0-alpha.3
12.1.0-alpha.4
12.1.0
12.1.1
12.1.2-alpha.1
12.1.2-alpha.2
12.1.2
12.1.3
12.1.4
12.1.5
12.1.6
13.0.0
13.0.1
README.md
latest

so it should be possible to write a script to checkout the latest version without having to supply a version number.

SamHasler avatar Nov 18 '20 06:11 SamHasler

Hey @SamHasler thanks for the research, I am hoping to dedicate sometime this weekend to automate this process, will post any updates here

iqbalansari avatar Nov 27 '20 14:11 iqbalansari