Skip to content

Commit 062ca54

Browse files
committed
improve error message when interpolations goes wrong.
fixing #93
1 parent 84d0348 commit 062ca54

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

source/lib/batchCompileTools.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
import batchSettings
44

55

6+
class BatchException(Exception):
7+
pass
8+
9+
610
def generateDesktopFonts(ufoPathsOrObjects, destinationRoot, format="ttf", decompose=True, removeOverlap=True, autohint=False, releaseMode=True, suffix=""):
711
if not isinstance(ufoPathsOrObjects, list):
812
ufoPathsOrObjects = [ufoPathsOrObjects]

source/lib/batchGenerators/variableFontsGenerator/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from ufo2fdk.kernFeatureWriter import side1Prefix, side2Prefix
1818

1919
from batchGenerators.batchTools import postProcessCollector, WOFF2Builder, buildTree, removeTree, BatchEditorOperator, Report
20+
from batchCompileTools import BatchException
2021

2122

2223
class GenerateVariableFont:
@@ -153,6 +154,9 @@ def makeSourceGlyphsCompatible(self):
153154
clip=False
154155
)
155156
self.report.write(f"Adding missing glyph '{glyphName}' in the default source '{defaultSource.info.familyName} {defaultSource.info.styleName}'")
157+
if result is None:
158+
# no result
159+
raise BatchException(f"Unable to generate instance for missing glyph '{glyphName}' in the default source. '{defaultSource.info.familyName} {defaultSource.info.styleName}'")
156160
# add the glyph to the default source
157161
glyph = defaultSource.newGlyph(glyphName)
158162
result.extractGlyph(glyph, onlyGeometry=True)
@@ -177,6 +181,9 @@ def makeSourceGlyphsCompatible(self):
177181
clip=False
178182
)
179183
self.report.write(f"Adding missing glyph '{glyphName}' in the source '{sourceFont.info.familyName} {sourceFont.info.styleName}'")
184+
if result is None:
185+
# no result
186+
raise BatchException(f"Unable to generate instance for missing glyph '{glyphName}' in the source '{sourceFont.info.familyName} {sourceFont.info.styleName}'")
180187
# add the glyph to the source
181188
glyph = sourceFont.newGlyph(glyphName)
182189
result.extractGlyph(glyph, onlyGeometry=True)

0 commit comments

Comments
 (0)