https://github.com/poomsmart/emojifonts
Python scripts to backport and theme Apple Color Emoji font.
https://github.com/poomsmart/emojifonts
apple emoji font ios theme unicode
Last synced: 3 months ago
JSON representation
Python scripts to backport and theme Apple Color Emoji font.
- Host: GitHub
- URL: https://github.com/poomsmart/emojifonts
- Owner: PoomSmart
- License: mit
- Created: 2022-02-19T06:18:35.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2026-02-21T04:41:05.000Z (4 months ago)
- Last Synced: 2026-02-21T11:31:13.967Z (4 months ago)
- Topics: apple, emoji, font, ios, theme, unicode
- Language: Python
- Homepage:
- Size: 4.71 MB
- Stars: 156
- Watchers: 4
- Forks: 6
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# EmojiFonts
Python and shell scripts to backport and theme [Apple Color Emoji font](https://en.wikipedia.org/wiki/Apple_Color_Emoji).
# Prerequisites
The following tools are required to build and theme the font.
### System Tools
* **Bash 5+**
* **[uv](https://github.com/astral-sh/uv)** (Recommended for managing Python environment and dependencies)
* **[pngquant](https://pngquant.org)** & **[oxipng](https://github.com/shssoichiro/oxipng)** (For PNG optimization)
* **For Theming**: [ImageMagick](https://imagemagick.org/), [librsvg](https://wiki.gnome.org/Projects/LibRsvg), and [svgo](https://github.com/svg/svgo)
**Install all system tools with Homebrew:**
```bash
brew install bash uv pngquant oxipng imagemagick librsvg svgo
```
### Python Dependencies
Python 3.11+ is required. All Python dependencies are automatically managed by `uv` and defined in `pyproject.toml`:
* `afdko`, `fonttools[repacker]`, `pillow`, and `pyliblzfse`.
These will be installed automatically into a virtual environment when you run `uv sync`.
# Before anything
1. Copy `Apple Color Emoji.ttc` from `/System/Library/Fonts` of your macOS instance to the root of this repository and rename it to `AppleColorEmoji_macOS.ttc`.
2. Copy AppleColorEmoji font from your iOS instance to the root of this repository and rename it to `AppleColorEmoji_iOS.ttc`. Read [here](https://poomsmart.github.io/emojiport) for the exact file path.
3. Execute `uv sync` to activate/synchronize the Python virtual environment.
4. Execute `./prepare.sh` to create emoji TTF files and tables. Run this once.
# Building Apple Color Emoji font
Build format: `./apple-prepare.sh && ./apple.sh [HD]`
Replace `` with `macOS` (if you have both macOS and iOS fonts) or `iOS` (if you only have iOS font).
Replace `[HD]` with `HD` if you want to build HD version (160x160 image set included), or leave it blank for normal version.
Executing `./apple-prepare.sh && ./apple.sh` will get `AppleColorEmoji@2x.ttc` (for iOS 10 and above) and `AppleColorEmoji@2x.ttf` (for iOS 9 and below) for you under `apple` directory.
# Notable Python Scripts
EmojiFonts deals with certain font tables; mainly `GDEF` and `sbix`.
`shift-multi.py` (or CLI alias `emojifonts-shift-multi`) resizes and shifts the multi-skinned emojis that pair up as one, including couples and handshake, to have them displayed on iOS 13 and below correctly where there is no render logic to automatically place the pair close together.
`GDEF` table which maps each of paired emojis to a certain class, is modified by the scripts. This is for the easiest backward-compatible solution for the emoji font. In this table, emojis with class `1` and `3` represent `left` and `right`, respectively. With those present, the text render engine on iOS 14+ will try to place the pair close together again even when we applied `shift-multi.py` to the font. Another script `remove-class3.py` ensures that there are no class `1` and `3` emojis that will otherwise be visible to the users.
`extractor.py` (CLI alias `emojifonts-extract`) extracts PNG emoji images from the font. This opens up the possibility to theme the emoji font.
Also in `extractor.py`, it detects glyphs of type `flip`, reads the actual image glyph ID that they reference to, programmatically flips them and then extracts them. `flip` glyphs are present in iOS 17.4 version of Apple Color Emoji font and not supported by any lower OS versions. They are for directional emojis - Apple has a single image for each direction, and the font uses `flip` glyphs to render the correct image.
`apple.py` (CLI alias `emojifonts-apple`) swaps in PNG assets extracted with the previous step back into the sbix table.
`remove-class3.py` (CLI alias `emojifonts-remove-class3`) trims class 3 glyph assignments from the Apple GDEF table.
# PNG Optimization
`pngquant` and `oxipng` are used to optimize the images with little to none changes to the quality. The Apple emoji font sizes are reduced by 50% using this method. The simpler the emoji images, the more size reduction is achieved.
# Verification
- Run `uv run pytest` to ensure the extractor, class trimming, and metric overrides behave as expected against the bundled fixtures.
- Run `uv run ruff check .` to lint the Python toolchain, or `uv run ruff format .` to auto-format when needed.
- After running `emojifonts-extract`, spot-check output with `open apple/images/64/u1F600.png` (or any glyph) and verify flipped glyphs are emitted.
- After `emojifonts-apple`, diff the sbix table with `ttx -o - apple/AppleColorEmoji@2x.ttc | grep -c ' && ./apple.sh HD` before following instructions below.
It is recommended to limit the depth of clone to `1` (`git clone --depth 1 git@github.com:PoomSmart/EmojiFonts.git`) because of a long history of commits.
## Blobmoji Emoji
1. Clone [blobmoji2](https://github.com/DavidBerdik/blobmoji2) and place its folder alongside this project.
2. Execute `cd blobmoji && ./blobmoji-noto.sh` to create themed font, output at `blobmoji/blobmoji.ttc`.
## Facebook Emoji
1. Clone [facebook-emojis](https://github.com/PoomSmart/facebook-emojis) and place its folder alongside this project.
3. Execute `cd facebook && ./facebook.sh` to create them themed font, output at `facebook/facebook.ttc`.
## FluentUI Emoji
1. Clone [fluentui-emoji](https://github.com/microsoft/fluentui-emoji) and place its folder alongside this project.
2. Execute `cd fluentui && ./fluentui.sh STYLE` (where `STYLE` is one of this list: `Color, Flat, High Contrast`) to create themed font, output at `fluentui/fluentui-STYLE.ttc`.
## Google Noto Color Emoji
1. Clone [noto-emoji](https://github.com/googlefonts/noto-emoji) and place its folder alongside this project.
2. Execute `cd noto-emoji && ./noto-emoji.sh` to create the themed font, output at `noto-emoji/noto-emoji.ttc`.
## JoyPixels Emoji
1. Clone [emoji-assets](https://github.com/joypixels/emoji-assets) and place its folder alongside this project.
2. Execute `cd joypixels && ./joypixels.sh` to create themed font, output at `joypixels/joypixels.ttc`.
## OpenMoji Emoji
1. Clone [openmoji](https://github.com/hfg-gmuend/openmoji) and place its folder alongside this project.
2. Execute `cd openmoji && ./openmoji.sh` to create themed font, output at `openmoji/openmoji.ttc`.
## Samsung One UI Emoji
1. Retrieve `SamsungColorEmoji.ttf` with Samsung One UI emojis somehow and place that in `oneui` folder.
2. Execute `cd oneui && ./oneui.sh` to create themed font, output at `oneui/oneui.ttc`.
## Toss Face Emoji
1. Download `TossFaceFontMac.ttf` from [tossface GitHub Releases](https://github.com/toss/tossface) and place that in `tossface` folder.
2. Execute `cd tossface && ./tossface.sh` to create themed font, output at `tossface/tossface.ttc`.
## Twitter Twemoji
1. Clone [twemoji](https://github.com/jdecked/twemoji) and place its folder alongside this project.
2. Execute `cd twemoji && ./twemoji.sh` to create the themed font, output at `twemoji/twemoji.ttc`.
## WhatsApp Emoji
1. Clone [whatsapp-emoji-linux](https://github.com/dmlls/whatsapp-emoji-linux) and place its folder alongside this project.
2. Execute `cd whatsapp && ./whatsapp.sh` to create themed font, output at `whatsapp/whatsapp.ttc`.