forked from madmalik/mononoki
-
Notifications
You must be signed in to change notification settings - Fork 1
/
create_font.sh
executable file
·61 lines (47 loc) · 1.8 KB
/
create_font.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
#!/usr/bin/env bash
mkdir -p export
function generate {
source=$1
export=$2
fontforge - << END
font = fontforge.open("$source")
if "$source"[-3:] == "ttf":
layers = font.layers
for layer_name in layers:
layers[layer_name].is_quadratic = True
for glyph in font.glyphs():
glyph.unlinkRef()
glyph.removeOverlap()
glyph.round()
glyph.addExtrema("all")
if glyph.validate() & 0x8 == 0x8:
glyph.correctDirection()
glyph.removeOverlap()
glyph.round()
glyph.addExtrema("all")
font.appendSFNTName("English (US)", "Copyright", """Original author:
Copyright (c) 2013-2022, Matthias Tellen matthias.tellen@googlemail.com
Modifications:
Copyright (c) 2020-2023, Marvin Dostal
Licensed under SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
https://scripts.sil.org/OFL""")
if ("English (US)", "SubFamily", "Bold-Italic") in font.sfnt_names:
font.appendSFNTName("English (US)", "SubFamily", "Bold Italic")
font.generate("$export")
END
}
generate 'src/monofoki-Regular.sfd' 'export/Monofoki-Regular.ttf'
generate 'src/monofoki-Italic.sfd' 'export/Monofoki-Italic.ttf'
generate 'src/monofoki-Bold.sfd' 'export/Monofoki-Bold.ttf'
generate 'src/monofoki-Bold-Italic.sfd' 'export/Monofoki-Bold-Italic.ttf'
if [[ "$*" == --hint ]]
then
ttfautohint export/Monofoki-Regular.ttf export/Monofoki-Regular-hinted.ttf
ttfautohint export/Monofoki-Italic.ttf export/Monofoki-Italic-hinted.ttf
ttfautohint export/Monofoki-Bold.ttf export/Monofoki-Bold-hinted.ttf
ttfautohint export/Monofoki-Bold-Italic.ttf export/Monofoki-Bold-Italic-hinted.ttf
fi
generate 'src/monofoki-Regular.sfd' 'export/Monofoki-Regular.otf'
generate 'src/monofoki-Italic.sfd' 'export/Monofoki-Italic.otf'
generate 'src/monofoki-Bold.sfd' 'export/Monofoki-Bold.otf'
generate 'src/monofoki-Bold-Italic.sfd' 'export/Monofoki-Bold-Italic.otf'