- Install tools
pip install fonttools brotli zopfli emoji
- Get list of emojis used in the project
python3 search_emoji.py path/to/project
- Get codes of desired emojis (JS code)
emojis = ["β€οΈ", "π©", "π₯", "π", "π€£", "π‘", "π", "π", "π", "πͺ
", "π₯³", "π", "π₯Ή", "π«Ά", "π« ", "πͺΏ", "π"]
emojis.map((emoji) => "U+" + emoji.codePointAt(0).toString(16)).join(", ")
- Get subset in woff2
pyftsubset NotoColorEmoji.ttf \
--output-file="EmojiColor.woff2" \
--flavor=woff2 \
--unicodes="U+2764, U+1f4a9, U+1f525, U+1f44b, U+1f923, U+1f621, U+1f64f, U+1f449, U+1f389, U+1fa85, U+1f973, U+1f38a, U+1f979, U+1faf6, U+1fae0, U+1fabf, U+1f393"
- Get subset in woff
pyftsubset NotoColorEmoji.ttf \
--output-file="EmojiColor.woff" \
--flavor=woff \
--unicodes="U+2764, U+1f4a9, U+1f525, U+1f44b, U+1f923, U+1f621, U+1f64f, U+1f449, U+1f389, U+1fa85, U+1f973, U+1f38a, U+1f979, U+1faf6, U+1fae0, U+1fabf, U+1f393"
- Include in CSS
@font-face {
font-family: "Font";
src: url("EmojiColor.woff2") format("woff2"), url("EmojiColor.woff") format("woff");
font-weight: normal;
font-style: normal;
}
Credits: https://markoskon.com/creating-font-subsets/