-
Notifications
You must be signed in to change notification settings - Fork 9
/
build.py
113 lines (58 loc) · 2.38 KB
/
build.py
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
## RUN ME VIA `fontforge -script build.py` ##
import fontforge, psMat
import math
fontforge.printSetup("pdf-file")
## regular
base_font = fontforge.open("sfd/14seg.sfd")
base_font.selection.all()
base_font.removeOverlap()
base_font.fontname = "LCD14"
base_font.save("sfd/14seg-gen.sfd")
base_font.generate("otf/"+base_font.fontname+".otf")
base_font.printSample("fontdisplay", 24, "", "specimens/"+base_font.fontname+".pdf")
print("Generated regular")
base_font.close()
## condensed
base_font = fontforge.open("sfd/14seg-gen.sfd")
base_font.selection.all()
matrix = psMat.scale(0.5, 1.0)
base_font.transform(matrix)
base_font.fullname = "LCD Display: 14 Segment (Condensed)"
base_font.fontname = "LCD14Condensed"
base_font.os2_width = 3 # Condensed
base_font.save("sfd/14seg-condensed.sfd")
base_font.generate("otf/"+base_font.fontname+".otf")
base_font.printSample("fontdisplay", 24, "", "specimens/"+base_font.fontname+".pdf")
base_font.close()
print("Generated condensed")
## italic
base_font = fontforge.open("sfd/14seg-gen.sfd")
base_font.selection.all()
matrix = psMat.skew(math.radians(12.5))
base_font.transform(matrix)
base_font.italicangle = -12.5
base_font.fullname = "LCD Display: 14 Segment (Italic)"
base_font.fontname = "LCD14Italic"
base_font.os2_stylemap = 0b1000000001 # italic https://www.microsoft.com/typography/otspec/os2.htm
base_font.save("sfd/14seg-italic.sfd")
base_font.generate("otf/"+base_font.fontname+".otf")
base_font.unlinkReferences() # This works around a FontForge bug
base_font.printSample("fontdisplay", 24, "", "specimens/"+base_font.fontname+".pdf")
base_font.close()
print("Generated italic")
## italic condensed
base_font = fontforge.open("sfd/14seg-condensed.sfd")
base_font.selection.all()
matrix = psMat.skew(math.radians(12.5))
base_font.transform(matrix)
base_font.italicangle = -12.5
base_font.fullname = "LCD Display: 14 Segment (Italic Condensed)"
base_font.fontname = "LCD14ItalicCondensed"
base_font.os2_width = 3 # Condensed
base_font.os2_stylemap = 0b1000000001 # italic https://www.microsoft.com/typography/otspec/os2.htm
base_font.save("sfd/14seg-italiccondensed.sfd")
base_font.generate("otf/"+base_font.fontname+".otf")
base_font.unlinkReferences() # This works around a FontForge bug
base_font.printSample("fontdisplay", 24, "", "specimens/"+base_font.fontname+".pdf")
base_font.close()
print("Generated italic condensed")