build_woff.sh 623 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/woff/${family_name}"
  8. echo "=============="
  9. echo
  10. echo " [i] Creating .woff files!"
  11. echo
  12. mkdir -p "${woff_dir}"
  13. rm -rf "${woff_dir:?}/"*
  14. # requires sfnt2woff-zopfli (get from https://github.com/bramstein/homebrew-webfonttools)
  15. for ttf in "${ttf_dir}/"*.ttf; do
  16. echo "sfnt2woff-zopfli ${ttf}"
  17. sfnt2woff-zopfli "${ttf}"
  18. done
  19. mv "${ttf_dir}/"*.woff "${woff_dir}"
  20. rm -f "${woff_dir}/FiraCode-Retina.woff"