Skip to content

Commit

Permalink
fix error overwriting lazy TTFont with --inplace option
Browse files Browse the repository at this point in the history
  • Loading branch information
anthrotype committed Jun 1, 2020
1 parent fedb93d commit e4d05f8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/cffsubr/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@ def main(args=None):
elif not options.output_file:
options.output_file = sys.stdout.buffer

with ttLib.TTFont(options.input_file, lazy=True) as font:
# Load TTFont lazily by default assuming output != input; load non-lazily if -i
# option is passed, so that fontTools let us overwrite the input file.
lazy = True if not options.inplace else None

with ttLib.TTFont(options.input_file, lazy=lazy) as font:
if options.desubroutinize:
cffsubr.desubroutinize(font)
else:
Expand Down

0 comments on commit e4d05f8

Please sign in to comment.