Skip to content

Commit 0fadf8c

Browse files
committed
Fix in in generating ttf var fonts: make them quadratic first and force reload for every variable font
1 parent b9f30e4 commit 0fadf8c

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

  • Batch.roboFontExt/lib/batchGenerators/variableFontsGenerator

Batch.roboFontExt/lib/batchGenerators/variableFontsGenerator/__init__.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ def __init__(self, operator, destinationPath, autohint=False, fitToExtremes=Fals
3636
# split the designspace first first
3737
self.operator = operator
3838
self.destinationPath = destinationPath
39+
self.binaryFormat = os.path.splitext(self.destinationPath)[-1][1:].lower()
3940
self.autohint = autohint
4041
self.fitToExtremes = fitToExtremes
4142
self.releaseMode = releaseMode
@@ -45,11 +46,12 @@ def __init__(self, operator, destinationPath, autohint=False, fitToExtremes=Fals
4546
self.build()
4647

4748
def build(self):
48-
self.operator.loadFonts()
49+
self.operator.loadFonts(reload=True)
4950

5051
self.makeMasterGlyphsCompatible()
5152
self.decomposedMixedGlyphs()
52-
# self.makeMasterGlyphsQuadractic()
53+
if self.binaryFormat == "ttf":
54+
self.makeMasterGlyphsQuadractic()
5355
self.makeMasterKerningCompatible()
5456
self.makeMasterOnDefaultLocation()
5557
self.makeLayerMaster()
@@ -295,14 +297,14 @@ def makeLayerMaster(self):
295297

296298
def generate(self):
297299
dirname = os.path.dirname(self.destinationPath)
298-
binaryFormat = os.path.splitext(self.destinationPath)[-1][1:]
300+
299301
# fontCompiler settings
300302
options = FontCompilerOptions()
301303
options.fdk = CurrentFDK()
302304
options.saveFDKPartsNextToUFO = self.debug
303305
options.shouldDecomposeWithCheckOutlines = False
304306
options.generateCheckComponentMatrix = True
305-
options.format = binaryFormat
307+
options.format = self.binaryFormat
306308
options.decompose = False
307309
options.checkOutlines = False
308310
options.autohint = self.autohint
@@ -313,7 +315,7 @@ def generate(self):
313315
# options.generateFeaturesWithFontTools = True
314316

315317
self.report.newLine()
316-
self.report.writeTitle(f"Generate {binaryFormat.upper()}", "'")
318+
self.report.writeTitle(f"Generate {self.binaryFormat.upper()}", "'")
317319
self.report.indent()
318320

319321
# map all master ufo paths to generated binaries
@@ -323,7 +325,7 @@ def generate(self):
323325
for sourceCount, sourceDescriptor in enumerate(self.operator.sources):
324326
source = self.operator.fonts[sourceDescriptor.name]
325327
# get the output path
326-
outputPath = os.path.join(dirname, f"temp_{sourceCount}_{source.info.familyName}-{source.info.styleName}.{binaryFormat}")
328+
outputPath = os.path.join(dirname, f"temp_{sourceCount}_{source.info.familyName}-{source.info.styleName}.{self.binaryFormat}")
327329
masterBinaryPaths[sourceDescriptor.path] = outputPath
328330
generatedFiles.add(outputPath)
329331
# set the output path

0 commit comments

Comments
 (0)