-
Notifications
You must be signed in to change notification settings - Fork 1
/
drawbot_proof.py
47 lines (36 loc) · 1.22 KB
/
drawbot_proof.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
def drawSpacing(font, leftMargin, rightMargin, topMargin, bottomMargin, fontSize, lineHeight):
gutter = 50
if isinstance(font, RFont):
fn = font.testInstall()
else:
fn = font
uc = "HOH%sHO%sOHO"
lc = "non%sno%sono"
glyphs = font.keys()
glyphs.sort()
t = FormattedString()
t.font(fn)
t.fontSize(24)
t.lineHeight(40)
for name in glyphs:
if name.isupper():
t.appendGlyph("H", "O", "H", name, "H", "O", name, "O", "H", "O")
t += "\n"
if name.islower():
t.appendGlyph("n", "o", "n", name, "n", "o", name, "o", "n", "o")
t += "\n"
max_width = t.size().width
orgin = leftMargin
overflow = textBox(t, (orgin, bottomMargin, int(max_width + 1), height()-(bottomMargin + topMargin)))
orgin = leftMargin + max_width + gutter
over = len(overflow)
while over > 0:
print over
if orgin + max_width > width() - rightMargin:
newPage()
orgin = leftMargin
overflow = textBox(overflow, (orgin, bottomMargin, int(max_width + 1), height()-(bottomMargin + topMargin)))
over = len(overflow)
orgin = orgin + max_width + gutter
size(1000,2000)
drawSpacing(CurrentFont(), 50, 50, 100, 100, 24, 40)