build 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. #!/bin/bash -e
  2. source venv/bin/activate
  3. # ============================================================================
  4. # VARIABLE FONT ==============================================================
  5. # variable font
  6. firaCodeVF=distr/variable_ttf/FiraCode-VF.ttf
  7. rm -rf $firaCodeVF
  8. fontmake -g FiraCode.glyphs -o variable --output-dir distr/variable_ttf
  9. # fix variable font metadata – very important
  10. gftools fix-vf-meta $firaCodeVF
  11. mv $firaCodeVF.fix $firaCodeVF
  12. # other fixes for metadata and hinting
  13. gftools fix-nonhinting $firaCodeVF $firaCodeVF
  14. gftools fix-gasp --autofix $firaCodeVF
  15. mv $firaCodeVF.fix $firaCodeVF
  16. gftools fix-dsig --autofix $firaCodeVF
  17. # cleanup of temp files
  18. rm -rf distr/variable_ttf/*-gasp*
  19. # TODO (late 2019?): use TTFautohint-VF for variable font (current support is minimal)
  20. # ============================================================================
  21. # STATIC FONTS ===============================================================
  22. rm -rf distr/ttf
  23. fontmake -g FiraCode.glyphs -o ttf --output-dir distr/ttf -i
  24. rm -rf distr/otf
  25. fontmake -g FiraCode.glyphs -o otf --output-dir distr/otf -i
  26. # -------------------------------------------------------------
  27. # Autohinting -------------------------------------------------
  28. statics=$(ls distr/ttf/*.ttf)
  29. for file in $statics; do
  30. echo "fix DSIG in " ${file}
  31. gftools fix-dsig --autofix ${file}
  32. echo "TTFautohint " ${file}
  33. # autohint with detailed info
  34. hintedFile=${file/".ttf"/"-hinted.ttf"}
  35. ttfautohint -I ${file} ${hintedFile} --stem-width-mode nnn --composites --windows-compatibility
  36. cp ${hintedFile} ${file}
  37. rm -rf ${hintedFile}
  38. done
  39. # ============================================================================
  40. # Build woff2 fonts ==========================================================
  41. # requires woff2_compress (get from https://github.com/bramstein/homebrew-webfonttools)
  42. rm -rf distr/woff2
  43. ttfs=$(ls distr/*/*.ttf)
  44. for ttf in $ttfs; do
  45. woff2_compress $ttf
  46. done
  47. mkdir -p distr/woff2
  48. woff2s=$(ls distr/*/*.woff2)
  49. for woff2 in $woff2s; do
  50. mv $woff2 distr/woff2/$(basename $woff2)
  51. done
  52. # ============================================================================
  53. # Build woff fonts ===========================================================
  54. # requires sfnt2woff-zopfli (get from https://github.com/bramstein/homebrew-webfonttools)
  55. rm -rf distr/woff
  56. ttfs=$(ls distr/*/*.ttf)
  57. for ttf in $ttfs; do
  58. sfnt2woff-zopfli $ttf
  59. done
  60. mkdir -p distr/woff
  61. woffs=$(ls distr/*/*.woff)
  62. for woff in $woffs; do
  63. mv $woff distr/woff/$(basename $woff)
  64. done