forked from cmfwyp/Gelasio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·107 lines (83 loc) · 2.51 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
#!/bin/sh
source venv/bin/activate
set -e
cd sources
echo "Generating Static fonts"
mkdir -p ../fonts/ttfs
fontmake -g Gelasio-Roman.glyphs -i -o ttf --output-dir ../fonts/ttfs/
fontmake -g Gelasio-Italic.glyphs -i -o ttf --output-dir ../fonts/ttfs/
echo "Generating VFs"
mkdir -p ../fonts/variable
fontmake -g Gelasio-Roman.glyphs -o variable --output-path ../fonts/variable/Gelasio-Roman-VF.ttf
fontmake -g Gelasio-Italic.glyphs -o variable --output-path ../fonts/variable/Gelasio-Italic-VF.ttf
rm -rf master_ufo/ instance_ufo/
echo "Post processing"
ttfs=$(ls ../fonts/ttfs/*.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/ttfs/*backup*.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/*backup*.ttf
gftools fix-vf-meta $vfs;
for vf in $vfs
do
mv "$vf.fix" $vf;
done
cd ..
# ============================================================================
# Autohinting ================================================================
statics=$(ls fonts/ttfs/*.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/woff2
ttfs=$(ls fonts/*/*.ttf)
for ttf in $ttfs; do
woff2_compress $ttf
done
mkdir -p fonts/woff2
woff2s=$(ls fonts/*/*.woff2)
for woff2 in $woff2s; do
mv $woff2 fonts/woff2/$(basename $woff2)
done
# ============================================================================
# Build woff fonts ==========================================================
# requires https://github.com/bramstein/homebrew-webfonttools
rm -rf fonts/woff
ttfs=$(ls fonts/*/*.ttf)
for ttf in $ttfs; do
sfnt2woff-zopfli $ttf
done
mkdir -p fonts/woff
woffs=$(ls fonts/*/*.woff)
for woff in $woffs; do
mv $woff fonts/woff/$(basename $woff)
done