Skip to content

Commit

Permalink
font-patcher: Abort if fontforge did not generate patched font
Browse files Browse the repository at this point in the history
[why]
Under certain circumjstances Fontforge can not create a font. As the API
does not give any feedback we trudge along afterwards giving confusing
messages.

One example is when the patched font contains too many glyphs.

[how]
Check if the patched font has indeed been generated and is not empty.

Fixes: #1342

Signed-off-by: Fini Jastrow <[email protected]>
  • Loading branch information
Finii committed Sep 23, 2023
1 parent 75f7854 commit 3053972
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions font-patcher
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,9 @@ class font_patcher:

# Adjust flags that can not be changed via fontforge
if re.search('\\.[ot]tf$', self.args.font, re.IGNORECASE) and re.search('\\.[ot]tf$', outfile, re.IGNORECASE):
if not os.path.isfile(outfile) or os.path.getsize(outfile) < 1:
logger.critical("Something went wrong and Fontforge did not generate the new font - look for messages above")
sys.exit(1)
try:
source_font = TableHEADWriter(self.args.font)
dest_font = TableHEADWriter(outfile)
Expand Down

0 comments on commit 3053972

Please sign in to comment.