summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRasmus Andersson <rasmus@notion.se>2022-10-16 02:40:23 +0300
committerRasmus Andersson <rasmus@notion.se>2022-10-16 02:40:23 +0300
commitce3d561fcd973790b63dfa7a82d8bc5c23521b37 (patch)
tree8d7d22777abd8a275558727ba114275ad8f56a92
parent9d9bfc3eecdd7ee17fe36827c400c8dcc0eb4cd5 (diff)
downloadinter-ce3d561fcd973790b63dfa7a82d8bc5c23521b37.tar.xz
make postprocess_instance_ufo.py ~20% faster by only setting a defcon property when the value is different
-rw-r--r--misc/tools/postprocess_instance_ufo.py11
1 files 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):