-
Notifications
You must be signed in to change notification settings - Fork 10
/
build.sh
113 lines (100 loc) · 3.12 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
#!/bin/bash
# source venv/bin/activate
set -e
# BUILD SETTINGS
GOOGLE_FONTS_DIR="~/Google/fonts" # Where the Google Fonts repo is cloned: https://github.com/google/fonts
BUILD_STATIC_FONTS=true # Set to `true` if you want to build static fonts
# BUILD SETUP
source venv/bin/activate
mkdir -p fonts
mkdir -p fonts/ttf
mkdir -p fonts/otf
mkdir -p fonts/variable
# BUILD PROCESS
echo "\n****** STARTING THE CASKAYDIA COVE BUILD SCRIPT"
echo "BUILD START TIME: \c"
date
if [ "$1" = "-gf" ]; then
echo "\nPREPARING A PULL REQUEST TO GOOGLE FONTS AT: $GOOGLE_FONTS_DIR";
fi
if [ "$BUILD_STATIC_FONTS" = "true" ]; then
echo "\nBUILD STATIC FONTS = TRUE"
else
echo "\nBUILD STATIC FONTS = FALSE"
fi
echo "\nBUILDING VARIABLE FONTS WITH FONTMAKE..."
fontmake --mm-designspace sources/CaskaydiaCove.designspace -o variable \
--output-path fonts/variable/CaskaydiaCove\[wght\].ttf
# --verbose ERROR
if [ "$BUILD_STATIC_FONTS" = "true" ]; then
echo "\nBUILDING STATIC TTF FONTS WITH FONTMAKE..."
fontmake --mm-designspace sources/CaskaydiaCove.designspace -i -o ttf \
--output-dir fonts/ttf/ \
--verbose ERROR
echo "\nBUILDING STATIC OTF FONTS WITH FONTMAKE..."
fontmake --mm-designspace sources/CaskaydiaCove.designspace -i -o otf \
--output-dir fonts/otf/ \
--verbose ERROR
fi
echo "\nPOST-PROCESSING VFS"
vfs=$(ls fonts/variable/*.ttf)
for vf in $vfs
do
gftools fix-dsig --autofix $vf
gftools fix-nonhinting $vf $vf.fix
mv $vf.fix $vf
rm -rf fonts/variable/*-backup-fonttools-prep-gasp.ttf
done
if [ "$BUILD_STATIC_FONTS" = "true" ]; then
echo "\nPOST-PROCESSING STATIC TTFS"
ttfs=$(ls fonts/ttf/*.ttf)
echo $ttfs
for ttf in $ttfs
do
gftools fix-dsig --autofix $ttf
ttfautohint $ttf $ttf.fix
[ -f $ttf.fix ] && mv $ttf.fix $ttf
gftools fix-hinting $ttf
[ -f $ttf.fix ] && mv $ttf.fix $ttf
done
otfs=$(ls fonts/otf/*.otf)
for otf in $otfs
do
gftools fix-dsig -f $otf
done
fi
# GOOGLE FONTS FLAG (-gf) SECTION
METADATA='name: "Caskaydia Cove"
designer: "Aaron Bell"
license: "OFL"
category: "MONOSPACE"
date_added: "2020-07-20"
fonts {
name: "Caskaydia Cove"
style: "normal"
weight: 400
filename: "CaskaydiaCove[wght].ttf"
post_script_name: "CaskaydiaCove-Regular"
full_name: "Caskaydia Cove Regular"
copyright: "Copyright 2020 The Caskaydia Cove Project Authors (https://github.com/eliheuer/caskaydia-cove)"
}
subsets: "latin"
subsets: "menu"
axes {
tag: "wght"
min_value: 200.0
max_value: 700.0
}'
if [ "$1" = "-gf" ]; then
echo "\nMOVING FILES FOR A NEW PR TO ~/Google/fonts/ofl/caskaydiacove";
cp DESCRIPTION.en_us.html ~/Google/fonts/ofl/caskaydiacove/
cp FONTLOG.txt ~/Google/fonts/ofl/caskaydiacove/
echo "$METADATA" > ~/Google/fonts/ofl/caskaydiacove/METADATA.pb
cp OFL.txt ~/Google/fonts/ofl/caskaydiacove/OFL.txt
cp fonts/variable/CaskaydiaCove\[wght\].ttf ~/Google/fonts/ofl/caskaydiacove/
mkdir -p ~/Google/fonts/ofl/caskaydiacove/static
cp fonts/ttf/* ~/Google/fonts/ofl/caskaydiacove/static/
fi
# CLEAN UP BUILD FILES
rm -rf sources/instance_ufos
echo "\nDONE!😃"