make postprocess_instance_ufo.py ~20% faster by only setting a defcon property when the value is different

This commit is contained in:
Rasmus Andersson 2022-10-15 16:40:23 -07:00
parent 9d9bfc3eec
commit ce3d561fcd

View file

@ -20,11 +20,12 @@ def ufo_set_wws(ufo):
def fix_fractional_advance_width(ufo):
for g in ufo:
w = int(round(g.width))
# set twice to work around bug or weird behavior in defcon.
# If we don't do this, then fractional widths with .0 fraction are
# not updated to integer values.
g.width = w + 1
g.width = w
if w != g.width:
# set twice to work around bug or weird behavior in defcon.
# If we don't do this, then fractional widths with .0 fraction are
# not updated to integer values.
g.width = w + 1
g.width = w
def main(argv):