-
Notifications
You must be signed in to change notification settings - Fork 0
/
line_spacing.py
executable file
·71 lines (54 loc) · 1.37 KB
/
line_spacing.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
#!/usr/bin/python3
from fontParts.world import *
import sys
# Open UFO
ufo = sys.argv[1]
font = OpenFont(ufo)
# Line spacing metrics
# If there are two numbers for an expression, the second number is for a diacritic.
metrics = {
# beng
'Bhagirati': (-159, 881),
# deva
'Panini': (-665, 1384),
'Kautilya': (-627, 1426),
'Maurya': (-284, 747),
# gujr
'Gir': (-402, 801),
# guru
'Arjun': (-4, 659),
# knda
'Badami': (-326-200, 604),
'Kaveri': (-316-200, 686),
# mlym
'Vayalar': (-3, 596),
'Malabar': (-2, 600),
'Bailey': (-1304, 1434),
# orya
'Asika': (-333, 804),
# taml
'ThiruValluvar': (-512-202, 1520+455),
'Auvaiyar': (-342-99, 693+222),
'Vaigai': (-250-99, 742+229),
# telu
'Nirmal': (-421, 625),
'Asha': (-903, 1263),
'Elur': (-903, 1521)
}
metric = metrics[font.info.familyName]
descender, ascender = metric
# Modify UFO
font.info.ascender = ascender
font.info.descender = descender
font.info.openTypeOS2WinAscent = ascender
font.info.openTypeOS2WinDescent = -descender
font.info.openTypeOS2TypoAscender = ascender
font.info.openTypeOS2TypoDescender = descender
font.info.openTypeOS2TypoLineGap = 0
font.info.openTypeHheaAscender = ascender
font.info.openTypeHheaDescender = descender
font.info.openTypeHheaLineGap = 0
# Save UFO
font.changed()
font.save()
font.close()