build-statics.sh 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. TT_DIR=./fonts/ttf
  6. OT_DIR=./fonts/otf
  7. #Generating fonts ==========================================================
  8. #Requires fontmake https://github.com/googlefonts/fontmake
  9. echo ".
  10. CLEAN FONTS FOLDERS
  11. ."
  12. rm -rf $TT_DIR $OT_DIR
  13. mkdir -p $TT_DIR $OT_DIR
  14. echo ".
  15. GENERATING STATIC TTF
  16. ."
  17. fontmake -g ./sources/$thisFont.glyphs -i -o ttf --output-dir $TT_DIR
  18. fontmake -g ./sources/$thisFont-Italic.glyphs -i -o ttf --output-dir $TT_DIR
  19. echo ".
  20. GENERATING STATIC OTF
  21. ."
  22. fontmake -g ./sources/$thisFont.glyphs -i -o otf --output-dir $OT_DIR
  23. fontmake -g ./sources/$thisFont-Italic.glyphs -i -o otf --output-dir $OT_DIR
  24. #Post-processing fonts ======================================================
  25. #Requires gftools https://github.com/googlefonts/gftools
  26. #Requires ttfautohint-py https://github.com/fonttools/ttfautohint-py
  27. echo ".
  28. POST-PROCESSING TTF
  29. ."
  30. ttfs=$(ls $TT_DIR/*.ttf)
  31. for font in $ttfs
  32. do
  33. gftools fix-dsig --autofix $font
  34. python -m ttfautohint $font $font.fix
  35. [ -f $font.fix ] && mv $font.fix $font
  36. gftools fix-hinting $font
  37. [ -f $font.fix ] && mv $font.fix $font
  38. done
  39. echo ".
  40. POST-PROCESSING OTF
  41. ."
  42. otfs=$(ls $OT_DIR/*.otf)
  43. for font in $otfs
  44. do
  45. gftools fix-dsig --autofix $font
  46. gftools fix-weightclass $font
  47. [ -f $font.fix ] && mv $font.fix $font
  48. done
  49. rm -rf master_ufo/ instance_ufo/
  50. echo ".
  51. COMPLETE!
  52. ."