fix: use python3 for emoji codepoint extraction in font subsetting
All checks were successful
CI / update (push) Successful in 1m39s
All checks were successful
CI / update (push) Successful in 1m39s
grep -oP '.' splits multi-byte emoji into individual bytes when the locale is not UTF-8 (e.g. CI runners with LANG=C), causing pyftsubset to fail on invalid codepoints.
This commit is contained in:
@@ -29,18 +29,11 @@ fi
|
||||
EMOJIS="☀✝❄🌷🍂🎄🐇🍽🥫🛒🛍🚆⚡🎉🤝💸❤🖤✅❌🚀⚠✨🔄📋🖼📖🤖🌐🔐🔍🚫"
|
||||
# ────────────────────────────────────────────────────────────────────
|
||||
|
||||
# Build Unicode codepoint list from the emoji string
|
||||
UNICODES=""
|
||||
for char in $(echo "$EMOJIS" | grep -oP '.'); do
|
||||
code=$(printf 'U+%04X' "'$char")
|
||||
if [ -n "$UNICODES" ]; then
|
||||
UNICODES="$UNICODES,$code"
|
||||
else
|
||||
UNICODES="$code"
|
||||
fi
|
||||
done
|
||||
# Build Unicode codepoint list from the emoji string (Python for reliable Unicode handling)
|
||||
UNICODES=$(python3 -c "print(','.join(f'U+{ord(c):04X}' for c in '$EMOJIS'))")
|
||||
GLYPH_COUNT=$(python3 -c "print(len('$EMOJIS'))")
|
||||
|
||||
echo "Subsetting NotoColorEmoji with $(echo "$EMOJIS" | grep -oP '.' | wc -l) glyphs..."
|
||||
echo "Subsetting NotoColorEmoji with $GLYPH_COUNT glyphs..."
|
||||
|
||||
# Subset to TTF
|
||||
pyftsubset "$SRC_FONT" \
|
||||
|
||||
Reference in New Issue
Block a user