Skip to content

Instantly share code, notes, and snippets.

@glowinthedark
Last active August 15, 2023 11:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save glowinthedark/1f6913a38eddcdba4a99ebb06f74aeb5 to your computer and use it in GitHub Desktop.
Save glowinthedark/1f6913a38eddcdba4a99ebb06f74aeb5 to your computer and use it in GitHub Desktop.
TTC (True Type Font Collection) to TTF Extraction bash script
#!/usr/bin/env bash
# depends on:
# pip3 install fonttools
font="${1}"
for n in {1..10} ; do
echo $n
pyftsubset "${font}" --font-number=${n} \
--output-file="${font%.*}_chinese_only_${n}.ttf" \
--verbose
done
#!/usr/bin/env bash
# extract only Latin and Chinese unicode ranges from a TTC/TTF font
# depends on:
# pip3 install fonttools
font="${1}"
for n in {1..10} ; do
echo $n # CHINESE BASIC LATIN BOPOMOFO
pyftsubset "${font}" --unicodes=U+4E00-9FFF --unicodes=U+0000-007F --unicodes=U+3100-312F \
--font-number=${n} \
--output-file="${font%.*}_chinese_only_${n}.ttf" \
--verbose
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment