Skip to content

Latest commit

 

History

History

gen-data

What’s happening here?

Input

The emojis are categorized in text files in cats.

Each text file is a category, and a single emoji can be in more than one category.

Each line of those text files is an emoji followed by space followed by its name, although this specific name is not used.

The cats.yml file maps category IDs (text file names without the .txt extension) to category names. The order of the categories in cats.yml is important as it is the final order of presentation of those categories in the eventual UI.

The data from the emojis-.txt files comes from the Unicode CLDR project. I maintain my own database as, for some reason, the official emoji list lacks many VS-16 characters. Also, I added some unofficial keywords to specific emojis. The format of each block of emojis-.txt is:

First line

The emoji.

Second line

The name of the emoji (capitalized).

Third line

The |-separated keywords of the emoji (lowercase).

with-skin-tone-support.txt has the same format as a category text file. It contains the emojis which support emoji skin tone modifiers.

twemoji-svg contains the SVG files of the Twitter emoji project (see its license, twemoji-LICENSE-GRAPHICS). Each file name is a dash-separated list of codepoints (hexadecimal) used to create the emoji sequence followed by .svg.

Output

The create.py script creates the required files for the UI in the specified directory.

From the category files, it knows the supported emojis. It combines this with the data from the emojis-*.txt and with-skin-tone-support.txt files to create emojis.json. This is a map (emoji to info) for each supported emoji.

From the category files, it also creates cats.json which has the same content as cats.yml, but each category entry also has its full list of emojis.

create.py converts the Twemoji SVG files to 16×16, 24×24, 32×32, 40×40, and 48×48 PNG files.

create.py also creates emojis-16.png, emojis-24.png, emojis-32.png, emojis-40.png, and emojis-48.png which are single PNG files containing all the supported emojis in their final form. The purpose of this file is to accelerate the UI, not having to open hundreds of individual PNG files. It also creates emojis-png-locations-16.json, emojis-png-locations-24.json, emojis-png-locations-32.json, emojis-png-locations-40.json, and emojis-png-locations-48.json which map each emoji to its location (top-left corner), in pixels, within the corresponding emojis-*.png images.