-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-otfs.sh
executable file
·63 lines (52 loc) · 2.14 KB
/
build-otfs.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
#!/bin/bash
# Fail fast
set -e
source build-settings.sh
# -----------------------------------------------------------------------
# build OTFs
echo ""
echo "Building OTFs..."
# removing old files
rm -rf "$otfDir"
# making the otf directory
mkdir -p "$otfDir"
# TEMPLATE: Customize based on project needs
# remove "maxdepth 1" if you have subdirectories in your sources folder
# uncomment the below line if project uses UFOs instead of a designspace
# Also remove "--interpolate", "--check-compatibility", and "--expand-feature-to-instances"
# and change "--mm-designspace" to "--ufo-paths" if you are using UFOs
# #######################################################
# find "$sourcesDir" -maxdepth 1 -path '*.ufo' -print0 | while read -d $'\0' ufoFile
find "$sourcesDir" -maxdepth 1 -path '*.designspace' -print0 | while read -d $'\0' dsFile
do
# To learn more about these options, run `fontmake -h`
fontmake --mm-designspace "$dsFile" \
--output otf \
--interpolate \
--output-dir "$otfDir" \
--production-names \
--overlaps-backend pathops \
--subroutinizer cffsubr \
--optimize-cff 0 \
--flatten-components \
--check-compatibility \
--filter "DottedCircleFilter(pre=True)" \
--filter "PropagateAnchorsFilter(pre=True)" \
--expand-features-to-instances
done
# -----------------------------------------------------------------------
# post-processing OTFS
# this loops through otfs and applies PS hinting to them
find "$otfDir" -path '*.otf' -print0 | while read -d $'\0' fontFile
do
# ... removes Mac names
python "$buildScriptsDir/removeMacNames.py" "$fontFile"
# ... applies autohinting - Will throw error if no blue zones are set.
otfautohint "$fontFile" -v
# ... re-subroutinize
cffsubr --inplace "$fontFile"
done
# -----------------------------------------------------------------------
# Cleanup
# A fancy way to get rid of the UFO instances folder made by fontmake, to keep this folder, comment this line out with a "#"
find "$sourcesDir" -type d -name "instances" -exec rm -rf {} +