Skip to content

Commit

Permalink
update with DB amstelvar values from #1
Browse files Browse the repository at this point in the history
  • Loading branch information
djrrb committed Sep 18, 2019
1 parent 6d4e0e8 commit 8a9c199
Showing 1 changed file with 29 additions and 3 deletions.
32 changes: 29 additions & 3 deletions propagateKerning.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,37 @@ def getValueFromGlyphIndex(g, index):
default = OpenFont(os.path.join(os.getcwd(), defaultPath), showInterface=False)
defaultxtraValue = getValueFromGlyphIndex(default['H'], 22)[0] - getValueFromGlyphIndex(default['H'], 11)[0]

print('default', defaultxtraValue)
print("| Source | Multiplier | XTRA value |")
print('| default', '|', 1, '|', defaultxtraValue, '|')

for path in paths:
f = OpenFont(os.path.join(os.getcwd(), path), showInterface=False)
xtraValue = getValueFromGlyphIndex(f['H'], 22)[0] - getValueFromGlyphIndex(f['H'], 11)[0]
m = xtraValue / defaultxtraValue
print(path, m, xtraValue)

"""
Input: opsz 008 wdth 100 wght 400 lxtra 0.98 + from dxtra...
Input: opsz 014 wdth 050 wght 400 lxtra 1.10
Input: opsz 014 wdth 150 wght 400 lxtra 1.50
Input: opsz 014 wdth 100 wght 100 lxtra 1.40
Input: opsz 014 wdth 100 wght 900 lxtra 1.05
Input: opsz 144 wdth 100 wght 400 lxtra 1.20
"""
if path == 'Amstelvar-Roman-opsz-min.ufo':
m = 0.98
elif path == 'Amstelvar-Roman-wdthmin.ufo':
m *= 1.1
elif path == 'Amstelvar-Roman-wdthmax.ufo':
m *= 1.5
elif path == 'Amstelvar-Roman-wghtmax.ufo':
m *= 1.4
elif path == 'Amstelvar-Roman-wghtmin.ufo':
m *= 1.05
elif path == 'Amstelvar-Roman-opsz-max.ufo':
m *= 1.20

print('|', path, '|', m, '|', xtraValue, '|')

f.groups.clear()
f.kerning.clear()
Expand All @@ -77,4 +101,6 @@ def getValueFromGlyphIndex(g, index):
value = f.kerning[pair]
f.kerning[pair] = int(round(value * m))
f.save()
print('done')
print('done')


0 comments on commit 8a9c199

Please sign in to comment.