build_otf.sh 654 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. glyphs_file=${FIRACODE_GLYPHS_FILE:-"FiraCode.glyphs"}
  7. dir="distr/otf/${family_name}"
  8. mkdir -p "${dir}"
  9. rm -rf "${dir:?}/"*
  10. args=( "$@" )
  11. default_weights=( "Light" "Regular" "Retina" "Medium" "SemiBold" "Bold" )
  12. weights=( "${args[@]:-"${default_weights[@]}"}" )
  13. for weight in "${weights[@]}"; do
  14. file="${dir}/FiraCode-${weight}.otf"
  15. echo "=============="
  16. echo
  17. echo " [i] Creating ${file}"
  18. echo
  19. fontmake -g "${glyphs_file}" -o otf --output-path "${file}" -i ".* ${weight}"
  20. done