forked from theleagueof/league-spartan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·118 lines (81 loc) · 2.55 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#!/bin/sh
set -e
cd sources
echo "Generating Static fonts"
mkdir -p ../fonts/static/ttf
fontmake -g LeagueSpartanVariable.glyphs -i -o ttf --output-dir ../fonts/static/ttf/
mkdir -p ../fonts/static/otf
fontmake -g LeagueSpartanVariable.glyphs -i -o otf --output-dir ../fonts/static/otf/
cd ..
# ============================================================================
# Autohinting ================================================================
statics=$(ls fonts/static/ttf/*.ttf)
echo hello
for file in $statics; do
echo "fix DSIG in " ${file}
gftools fix-dsig --autofix ${file}
echo "TTFautohint " ${file}
# autohint with detailed info
hintedFile=${file/".ttf"/"-hinted.ttf"}
ttfautohint -I ${file} ${hintedFile}
cp ${hintedFile} ${file}
rm -rf ${hintedFile}
done
# ============================================================================
# Build woff2 fonts ==========================================================
# requires https://github.com/bramstein/homebrew-webfonttools
rm -rf fonts/web/woff2
ttfs=$(ls fonts/static/ttf/*.ttf)
for ttf in $ttfs; do
woff2_compress $ttf
done
mkdir -p fonts/web/woff2
woff2s=$(ls fonts/static/*/*.woff2)
for woff2 in $woff2s; do
mv $woff2 fonts/web/woff2/$(basename $woff2)
done
# ============================================================================
# Build woff fonts ==========================================================
# requires https://github.com/bramstein/homebrew-webfonttools
rm -rf fonts/web/woff
ttfs=$(ls fonts/static/ttf/*.ttf)
for ttf in $ttfs; do
sfnt2woff-zopfli $ttf
done
mkdir -p fonts/web/woff
woffs=$(ls fonts/static/*/*.woff)
for woff in $woffs; do
mv $woff fonts/web/woff/$(basename $woff)
done
cd sources
echo "Generating VFs"
mkdir -p ../fonts/variable
fontmake -g LeagueSpartanVariable.glyphs -o variable --output-path ../fonts/variable/LeagueSpartanVariable.ttf
rm -rf master_ufo/ instance_ufo/
cd ../fonts/variable
woff2_compress LeagueSpartanVariable.ttf
cd ..
echo "Post processing"
ttfs=$(ls ../fonts/static/ttf/*.ttf)
echo $ttfs
for ttf in $ttfs
do
gftools fix-dsig -f $ttf;
gftools fix-nonhinting $ttf $ttf.fix;
mv "$ttf.fix" $ttf;
done
rm ../fonts/static/ttf/*gasp.ttf
vfs=$(ls ../fonts/variable/*.ttf)
for vf in $vfs
do
gftools fix-dsig -f $vf;
gftools fix-nonhinting $vf $vf.fix;
mv "$vf.fix" $vf;
ttx -f -x "MVAR" $vf; # Drop MVAR. Table has issue in DW
rtrip=$(basename -s .ttf $vf)
new_file=../fonts/variable/$rtrip.ttx;
rm $vf;
ttx $new_file
rm ../fonts/variable/*.ttx
done
rm ../fonts/variable/*gasp.ttf