From ce3d561fcd973790b63dfa7a82d8bc5c23521b37 Mon Sep 17 00:00:00 2001 From: Rasmus Andersson Date: Sat, 15 Oct 2022 16:40:23 -0700 Subject: [PATCH] make postprocess_instance_ufo.py ~20% faster by only setting a defcon property when the value is different --- misc/tools/postprocess_instance_ufo.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/misc/tools/postprocess_instance_ufo.py b/misc/tools/postprocess_instance_ufo.py index 6c09e40cd..dcd9c397f 100644 --- a/misc/tools/postprocess_instance_ufo.py +++ b/misc/tools/postprocess_instance_ufo.py @@ -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):