forked from JetBrains/JetBrainsMono
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-statics.sh
executable file
·64 lines (52 loc) · 1.42 KB
/
build-statics.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
#!/bin/sh
[ -r env/bin/activate ] && . env/bin/activate
set -e
thisFont="JetBrainsMono" #must match the name in the font file
TT_DIR=./fonts/ttf
OT_DIR=./fonts/otf
#Generating fonts ==========================================================
#Requires fontmake https://github.com/googlefonts/fontmake
echo ".
CLEAN FONTS FOLDERS
."
rm -rf $TT_DIR $OT_DIR
mkdir -p $TT_DIR $OT_DIR
echo ".
GENERATING STATIC TTF
."
fontmake -g ./sources/$thisFont.glyphs -i -o ttf --output-dir $TT_DIR
fontmake -g ./sources/$thisFont-Italic.glyphs -i -o ttf --output-dir $TT_DIR
echo ".
GENERATING STATIC OTF
."
fontmake -g ./sources/$thisFont.glyphs -i -o otf --output-dir $OT_DIR
fontmake -g ./sources/$thisFont-Italic.glyphs -i -o otf --output-dir $OT_DIR
#Post-processing fonts ======================================================
#Requires gftools https://github.com/googlefonts/gftools
#Requires ttfautohint-py https://github.com/fonttools/ttfautohint-py
echo ".
POST-PROCESSING TTF
."
ttfs=$(ls $TT_DIR/*.ttf)
for font in $ttfs
do
gftools fix-dsig --autofix $font
python -m ttfautohint $font $font.fix
[ -f $font.fix ] && mv $font.fix $font
gftools fix-hinting $font
[ -f $font.fix ] && mv $font.fix $font
done
echo ".
POST-PROCESSING OTF
."
otfs=$(ls $OT_DIR/*.otf)
for font in $otfs
do
gftools fix-dsig --autofix $font
gftools fix-weightclass $font
[ -f $font.fix ] && mv $font.fix $font
done
rm -rf master_ufo/ instance_ufo/
echo ".
COMPLETE!
."