-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate_base_chars.py
62 lines (48 loc) · 1.82 KB
/
generate_base_chars.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
# load your font, etc…
font = fontforge.open("font_name.otf")
chara = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "r", "s", "t", "u", "v", "w", "y", "adieresis", "odieresis"]
chara2 = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "R", "S", "T", "U", "V", "W", "Y", "Adieresis", "Odieresis"]
for x in chara:
ligature_name = x + ".top"
glyph = font.createChar(-1, ligature_name)
pen = font[ligature_name].glyphPen(replace=False);
font["hyphen"].draw(pen);
pen = None;
glyph.width = 2048
ligature_name = x + ".bottom"
glyph = font.createChar(-1, ligature_name)
pen = font[ligature_name].glyphPen(replace=False);
font["hyphen"].draw(pen);
pen = None;
glyph.width = 2048
ligature_name = x + ".left"
glyph = font.createChar(-1, ligature_name)
pen = font[ligature_name].glyphPen(replace=False);
font["hyphen"].draw(pen);
pen = None;
glyph.width = 2048
ligature_name = x + ".top2"
glyph = font.createChar(-1, ligature_name)
pen = font[ligature_name].glyphPen(replace=False);
font["hyphen"].draw(pen);
pen = None;
glyph.width = 2048
ligature_name = x + ".bottom2"
glyph = font.createChar(-1, ligature_name)
pen = font[ligature_name].glyphPen(replace=False);
font["hyphen"].draw(pen);
pen = None;
glyph.width = 2048
for y in chara2:
ligature_name = y + ".top"
glyph = font.createChar(-1, ligature_name)
pen = font[ligature_name].glyphPen(replace=False);
font["hyphen"].draw(pen);
pen = None;
glyph.width = 2048
ligature_name = y + ".bottom"
glyph = font.createChar(-1, ligature_name)
pen = font[ligature_name].glyphPen(replace=False);
font["hyphen"].draw(pen);
pen = None;
glyph.width = 2048