build.sh 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #!/bin/sh
  2. set -e
  3. # Go the sources directory to run commands
  4. SOURCE="${BASH_SOURCE[0]}"
  5. DIR=$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )
  6. cd $DIR
  7. echo $(pwd)
  8. echo "Generating Static fonts"
  9. mkdir -p ../fonts
  10. fontmake --keep-overlaps -m RobotoMono.designspace -i -o ttf --output-dir ../fonts/ttf/
  11. fontmake --keep-overlaps -m RobotoMono-Italic.designspace -i -o ttf --output-dir ../fonts/ttf/
  12. echo "Generating VFs"
  13. mkdir -p ../fonts/variable
  14. fontmake -m RobotoMono.designspace -o variable --output-path ../fonts/variable/RobotoMono[wght].ttf
  15. fontmake -m RobotoMono-Italic.designspace -o variable --output-path ../fonts/variable/RobotoMono-Italic[wght].ttf
  16. rm -rf master_ufo/ instance_ufo/ instance_ufos/ instances/
  17. echo "Post processing"
  18. ttfs=$(ls ../fonts/ttf/*.ttf)
  19. for ttf in $ttfs
  20. do
  21. gftools fix-dsig -f $ttf;
  22. echo "TTF AH"
  23. python3 -m ttfautohint --stem-width-mode nnn $ttf "$ttf.fix";
  24. mv "$ttf.fix" $ttf;
  25. done
  26. echo "Fixing monospace metadata"
  27. for ttf in $ttfs
  28. do
  29. gftools fix-isfixedpitch --fonts $ttf;
  30. mv "$ttf.fix" $ttf;
  31. done
  32. vfs=$(ls ../fonts/variable/*\[wght\].ttf)
  33. echo "Post processing VFs"
  34. for vf in $vfs
  35. do
  36. gftools fix-dsig -f $vf;
  37. done
  38. echo "Fixing VF monospace metadata"
  39. for vf in $vfs
  40. do
  41. gftools fix-isfixedpitch --fonts $vf;
  42. mv "$vf.fix" $vf;
  43. done
  44. echo "Fixing VF Meta"
  45. # gftools fix-vf-meta $vfs;
  46. # for vf in $vfs
  47. # do
  48. # mv "$vf.fix" $vf;
  49. # done
  50. statmake --stylespace stat.stylespace --designspace RobotoMono.designspace --output-path ../fonts/variable/RobotoMono[wght].ttf ../fonts/variable/RobotoMono[wght].ttf;
  51. statmake --stylespace stat.stylespace --designspace RobotoMono-Italic.designspace --output-path ../fonts/variable/RobotoMono-Italic[wght].ttf ../fonts/variable/RobotoMono-Italic[wght].ttf;
  52. echo "Dropping MVAR"
  53. for vf in $vfs
  54. do
  55. ttx -f -x "MVAR" $vf; # Drop MVAR. Table has issue in DW
  56. rtrip=$(basename -s .ttf $vf)
  57. new_file=../fonts/variable/$rtrip.ttx;
  58. rm $vf;
  59. ttx $new_file
  60. rm $new_file
  61. done
  62. echo "Fixing Hinting"
  63. for vf in $vfs
  64. do
  65. gftools fix-nonhinting $vf $vf.fix;
  66. mv "$vf.fix" $vf;
  67. done
  68. rm ../fonts/variable/*gasp.ttf