build-vf.sh 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/bin/sh
  2. [ -r env/bin/activate ] && . env/bin/activate
  3. set -e
  4. thisFont="JetBrainsMono" #must match the name in the font file
  5. VF_DIR=./fonts/variable
  6. #Generating fonts ==========================================================
  7. #Requires fontmake https://github.com/googlefonts/fontmake
  8. echo "CLEAN FONTS FOLDERS"
  9. rm -rf $VF_DIR
  10. mkdir -p $VF_DIR
  11. echo ".
  12. GENERATING VARIABLE
  13. ."
  14. fontmake -g ./sources/$thisFont.glyphs -o variable --output-path $VF_DIR/$thisFont[wght].ttf
  15. fontmake -g ./sources/$thisFont-Italic.glyphs -o variable --output-path $VF_DIR/$thisFont-Italic[wght].ttf
  16. #Post-processing fonts ======================================================
  17. #Requires gftools https://github.com/googlefonts/gftools
  18. echo ".
  19. POST-PROCESSING VF
  20. ."
  21. vfs=$(ls $VF_DIR/*.ttf)
  22. for font in $vfs
  23. do
  24. gftools fix-dsig --autofix $font
  25. gftools fix-nonhinting $font $font.fix
  26. mv $font.fix $font
  27. gftools fix-unwanted-tables --tables MVAR $font
  28. done
  29. rm $VF_DIR/*gasp*
  30. gftools fix-vf-meta $VF_DIR/$thisFont[wght].ttf $VF_DIR/$thisFont-Italic[wght].ttf
  31. for font in $vfs
  32. do
  33. mv $font.fix $font
  34. done
  35. rm -rf ./master_ufo/ ./instance_ufo/
  36. echo ".
  37. COMPLETE!
  38. ."