font-patcher: Optimize font tweaking for ttc

[why]
When we have a ttc and tweak the contained fonts we recalculate the
total checksum after each tweak while we only need to tweak it after all
changes (included fonts) have been tweaked.

[how]
Pull the total checksum recalculation out of the subfonts loop.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
This commit is contained in:
Fini Jastrow 2023-04-12 15:31:28 +02:00 committed by Fini
parent ae7d6a5744
commit cf59464e52

View file

@ -421,7 +421,8 @@ class font_patcher:
dest_font.putshort(source_font.lowppem, 'lowestRecPPEM') dest_font.putshort(source_font.lowppem, 'lowestRecPPEM')
if dest_font.modified: if dest_font.modified:
dest_font.reset_table_checksum() dest_font.reset_table_checksum()
dest_font.reset_full_checksum() if dest_font.modified:
dest_font.reset_full_checksum()
except Exception as error: except Exception as error:
print("Can not handle font flags ({})".format(repr(error))) print("Can not handle font flags ({})".format(repr(error)))
finally: finally: