From 3053972f8691ae3203bc1db10e2e09266012224b Mon Sep 17 00:00:00 2001 From: Fini Jastrow Date: Sat, 23 Sep 2023 11:17:59 +0200 Subject: [PATCH] font-patcher: Abort if fontforge did not generate patched font [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 --- font-patcher | 3 +++ 1 file changed, 3 insertions(+) diff --git a/font-patcher b/font-patcher index ab875da2e6..1d0f4a3e7d 100755 --- a/font-patcher +++ b/font-patcher @@ -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)