EmojiFonts
Python and shell scripts to backport and theme Apple Color Emoji font.
git clone https://github.com/PoomSmart/EmojiFonts.gitPoomSmart/EmojiFontsEmojiFonts
Python and shell scripts to backport and theme Apple Color Emoji font.
Prerequisites
The following tools are required to build and theme the font.
System Tools
- Bash 5+
- uv (Recommended for managing Python environment and dependencies)
- pngquant & oxipng (For PNG optimization)
- For Theming: ImageMagick, librsvg, and svgo
Install all system tools with Homebrew:
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, andpyliblzfse.
These will be installed automatically into a virtual environment when you run uv sync.
Before anything
- Copy
Apple Color Emoji.ttcfrom/System/Library/Fontsof your macOS instance to the root of this repository and rename it toAppleColorEmoji_macOS.ttc. - Copy AppleColorEmoji font from your iOS instance to the root of this repository and rename it to
AppleColorEmoji_iOS.ttc. Read here for the exact file path. - Execute
uv syncto activate/synchronize the Python virtual environment. - Execute
./prepare.shto create emoji TTF files and tables. Run this once.
Building Apple Color Emoji font
Build format: ./apple-prepare.sh <OS> && ./apple.sh [HD]
Replace <OS> 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 <OS> && ./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.
inject_neutral_couple_silhouette.py (CLI alias emojifonts-inject-silhouette) patches the morx table in the compiled iOS font to add silhouette support for neutral-person (U+1F9D1) holding-hands couples — support that Apple never shipped. It inserts a ContextualMorph subtable and updates the two NoncontextualMorph silhouette subtables; themed fonts need no per-combination images. See MORX.md for a full technical explanation.
emjc.py decodes Apple's proprietary EMJC (emj1) image format — the compressed bitmap encoding used for emoji strikes in newer sbix tables — back to raw BGRA pixel data.
emjc_encoder.py (CLI entry point) is the companion encoder: given raw BGRA data and image dimensions it produces a valid EMJC file, with an optional color-quantization pass to reduce output size. convert_to_emjc.sh wraps the encoder for parallel batch conversion of PNG emoji assets. See EMJC.md for a full technical explanation of the format.
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 pytestto 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, oruv run ruff format .to auto-format when needed. - After running
emojifonts-extract, spot-check output withopen apple/images/64/u1F600.png(or any glyph) and verify flipped glyphs are emitted. - After
emojifonts-apple, diff the sbix table withttx -o - apple/AppleColorEmoji@2x.ttc | grep -c '<glyph'to confirm the strike counts remain unchanged.
Troubleshooting
Flip glyph references unknown glyph: regenerate TTX tables with./prepare.shto keep sbix data in sync with recent Apple font updates.Overrides refer to missing glyph metrics: re-runemojifonts-shift-multiagainst the freshly exportedhmtx.ttx; stale files from earlier releases omit the new handshake glyphs.pngquant: command not found: install the dependency viabrew install pngquant(or remove the optimizer by settingPNGQUANT=0before invoking shell helpers).
Theming
Theming scripts for all emojis vendors produce the font in TTC format. The font may be used by EmojiFontManager iOS tweak, and is guaranteed to work on iOS 6 and higher. Ensure that you executed ./apple-prepare.sh <OS> && ./apple.sh && ./apple.sh HD before following instructions below.
Blobmoji Emoji
- Clone blobmoji2 and place its folder alongside this project.
- Execute
cd blobmoji && ./blobmoji-noto.shto create themed font, output atblobmoji/blobmoji.ttc.
Facebook Emoji
- Clone facebook-emojis and place its folder alongside this project.
- Execute
cd facebook && ./facebook.shto create them themed font, output atfacebook/facebook.ttc.
FluentUI Emoji
- Clone fluentui-emoji and place its folder alongside this project.
- Execute
cd fluentui && ./fluentui.sh STYLE(whereSTYLEis one of this list:Color, Flat, High Contrast) to create themed font, output atfluentui/fluentui-STYLE.ttc.
Google Noto Color Emoji
- Clone noto-emoji and place its folder alongside this project.
- Execute
cd noto-emoji && ./noto-emoji.shto create the themed font, output atnoto-emoji/noto-emoji.ttc.
JoyPixels Emoji
- Clone emoji-assets and place its folder alongside this project.
- Execute
cd joypixels && ./joypixels.shto create themed font, output atjoypixels/joypixels.ttc.
OpenMoji Emoji
- Clone openmoji and place its folder alongside this project.
- Execute
cd openmoji && ./openmoji.shto create themed font, output atopenmoji/openmoji.ttc.
Samsung One UI Emoji
- Retrieve
SamsungColorEmoji.ttfwith Samsung One UI emojis somehow and place that inoneuifolder. - Execute
cd oneui && ./oneui.shto create themed font, output atoneui/oneui.ttc.
Toss Face Emoji
- Download
TossFaceFontMac.ttffrom tossface GitHub Releases and place that intossfacefolder. - Execute
cd tossface && ./tossface.shto create themed font, output attossface/tossface.ttc.
Twitter Twemoji
- Clone twemoji and place its folder alongside this project.
- Execute
cd twemoji && ./twemoji.shto create the themed font, output attwemoji/twemoji.ttc.
WhatsApp Emoji
- Clone whatsapp-emoji-linux and place its folder alongside this project.
- Execute
cd whatsapp && ./whatsapp.shto create themed font, output atwhatsapp/whatsapp.ttc.
more like this
chinese-hershey-font
Convert Chinese Characters to Single-Line Fonts using Computer Vision