This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
update_all_kerning_pairs [2015/09/02 10:06] johan |
update_all_kerning_pairs [2015/09/02 13:06] johan |
||
---|---|---|---|
Line 10: | Line 10: | ||
tree = etree.parse('FontWithKerning.bf') | tree = etree.parse('FontWithKerning.bf') | ||
for elem in tree.xpath(".//kerning"): | for elem in tree.xpath(".//kerning"): | ||
- | k = float (elem.attrib['hadjustment']) | + | kerning = float (elem.attrib['hadjustment']) |
| | ||
# add 10 more units of space to each kerning pair | # add 10 more units of space to each kerning pair | ||
- | elem.attrib['hadjustment'] = str (k - 10) | + | elem.attrib['hadjustment'] = str (kerning - 10) |
- | with open('FontUpdatedKerning.bf', 'wb') as file_handle: | + | with open('FontWithUpdatedKerning.bf', 'wb') as file_handle: |
file_handle.write(etree.tostring(tree, pretty_print=True, encoding='utf8')) | file_handle.write(etree.tostring(tree, pretty_print=True, encoding='utf8')) | ||
</file> | </file> |