-
Notifications
You must be signed in to change notification settings - Fork 153
/
build.sh
executable file
·53 lines (42 loc) · 1.24 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
#!/usr/bin/env sh
set -e
family=Hasklig
roman_weights=(Black Bold ExtraLight Light Medium Regular Semibold)
italic_weights=(BlackIt BoldIt ExtraLightIt LightIt MediumIt It SemiboldIt)
# get absolute path to bash script
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
# clean existing build artifacts
rm -rf $DIR/target/
otf_dir="$DIR/target/OTF"
ttf_dir="$DIR/target/TTF"
mkdir -p $otf_dir $ttf_dir
function build_font {
# $1 is Roman or Italic
# $2 is weight name
font_dir=$DIR/$1/Instances/$2
font_ufo=$font_dir/font.ufo
ps_name=$family-$2
echo $ps_name
echo "Building OTF ..."
# -r is for "release mode" (subroutinization + applied glyph order)
# -gs is for filtering the output font to contain only glyphs in the GOADB
makeotf -f $font_ufo -r -gs -omitMacNames
echo "Building TTF ..."
otf2ttf $font_dir/$ps_name.otf
echo "Componentizing TTF ..."
ttfcomponentizer $font_dir/$ps_name.ttf
# move font files to target directory
mv $font_dir/$ps_name.otf $otf_dir
mv $font_dir/$ps_name.ttf $ttf_dir
echo "Done with $ps_name"
echo ""
echo ""
}
for w in ${roman_weights[@]}
do
build_font Roman $w
done
for w in ${italic_weights[@]}
do
build_font Italic $w
done