build_woff2.sh 621 B

123456789101112131415161718192021222324252627
  1. #!/bin/bash
  2. set -o errexit -o nounset -o pipefail
  3. cd "$(dirname "$0")/.."
  4. [ -d venv ] && source venv/bin/activate
  5. family_name=${FIRACODE_FAMILY_NAME:-"Fira Code"}
  6. ttf_dir="distr/ttf/${family_name}"
  7. woff_dir="distr/woff2/${family_name}"
  8. echo "=============="
  9. echo
  10. echo " [i] Creating .woff2 files!"
  11. echo
  12. mkdir -p "${woff_dir}"
  13. rm -rf "${woff_dir:?}/"*
  14. # requires woff2_compress (get from https://github.com/bramstein/homebrew-webfonttools)
  15. for ttf in "${ttf_dir}/"*.ttf; do
  16. echo "woff2_compress ${ttf}"
  17. woff2_compress "${ttf}"
  18. done
  19. mv "${ttf_dir}/"*.woff2 "${woff_dir}"
  20. rm -f "${woff_dir}/FiraCode-Retina.woff2"