@@ -393,24 +393,35 @@ def _convertPath(self, path, destDir, saveOTF=True, saveTTF=True, saveWOFF=True,
393393 fileName += suffix
394394 fileName = fileName .replace (" " , "_" )
395395
396+ # if Export in Sub Folder is selected, build a directory for each format
396397 if self .controller .exportInFolders ():
397- fontDir = os .path .join (destDir , familyName .replace (" " , "" ), styleName .replace (" " , "" ))
398+ otfDir = os .path .join (destDir , 'otf' )
399+ ttfDir = os .path .join (destDir , 'ttf' )
400+ woffDir = os .path .join (destDir , 'woff' )
401+ woff2Dir = os .path .join (destDir , 'woff2' )
402+ eotDir = os .path .join (destDir , 'eot' )
403+ svgDir = os .path .join (destDir , 'svg' )
398404 else :
399- fontDir = destDir
400-
401- otfPath = os .path .join (fontDir , fileName + ".otf" )
402- ttfPath = os .path .join (fontDir , fileName + ".ttf" )
403- woffPath = os .path .join (fontDir , fileName + ".woff" )
404- woff2Path = os .path .join (fontDir , fileName + ".woff2" )
405- eotPath = os .path .join (fontDir , fileName + ".eot" )
406- svgPath = os .path .join (fontDir , fileName + ".svg" )
405+ otfDir = destDir
406+ ttfDir = destDir
407+ woffDir = destDir
408+ woff2Dir = destDir
409+ eotDir = destDir
410+ svgDir = destDir
411+
412+ otfPath = os .path .join (otfDir , fileName + ".otf" )
413+ ttfPath = os .path .join (ttfDir , fileName + ".ttf" )
414+ woffPath = os .path .join (woffDir , fileName + ".woff" )
415+ woff2Path = os .path .join (woff2Dir , fileName + ".woff2" )
416+ eotPath = os .path .join (eotDir , fileName + ".eot" )
417+ svgPath = os .path .join (svgDir , fileName + ".svg" )
407418
408419 # save otf
409420 if saveOTF :
410421 report .writeTitle ("Build OTF" , "'" )
411422 report .indent ()
412423 report .write ("path: %s" % otfPath )
413- buildTree (fontDir )
424+ buildTree (otfDir )
414425 temp = self ._getTempOTF (path , report = report , preserveTTFhints = preserveTTFhints )
415426 shutil .copyfile (temp , otfPath )
416427 report .dedent ()
@@ -421,7 +432,7 @@ def _convertPath(self, path, destDir, saveOTF=True, saveTTF=True, saveWOFF=True,
421432 report .writeTitle ("Build TTF" , "'" )
422433 report .indent ()
423434 report .write ("path: %s" % ttfPath )
424- buildTree (fontDir )
435+ buildTree (ttfDir )
425436 temp = self ._getTempTTF (path , report = report , preserveTTFhints = preserveTTFhints )
426437 shutil .copyfile (temp , ttfPath )
427438 report .dedent ()
@@ -438,7 +449,7 @@ def _convertPath(self, path, destDir, saveOTF=True, saveTTF=True, saveWOFF=True,
438449 report .writeTitle ("Build WOFF (%s)" % reportFormat , "'" )
439450 report .indent ()
440451 report .write ("path: %s" % woffPath )
441- buildTree (fontDir )
452+ buildTree (woffDir )
442453 temp = func (path , report = report , preserveTTFhints = preserveTTFhints )
443454 convertToWoff (temp , woffPath )
444455 report .dedent ()
@@ -455,7 +466,7 @@ def _convertPath(self, path, destDir, saveOTF=True, saveTTF=True, saveWOFF=True,
455466 report .writeTitle ("Build WOFF2 (%s)" % reportFormat , "'" )
456467 report .indent ()
457468 report .write ("path: %s" % woff2Path )
458- buildTree (fontDir )
469+ buildTree (woff2Dir )
459470 temp = func (path , report = report , preserveTTFhints = preserveTTFhints )
460471 convertToWoff2 (temp , woff2Path )
461472 report .dedent ()
@@ -466,7 +477,7 @@ def _convertPath(self, path, destDir, saveOTF=True, saveTTF=True, saveWOFF=True,
466477 report .writeTitle ("Build EOT" , "'" )
467478 report .indent ()
468479 report .write ("path: %s" % eotPath )
469- buildTree (fontDir )
480+ buildTree (eotDir )
470481 temp = self ._getTempTTF (path , report = report , preserveTTFhints = preserveTTFhints )
471482 convertToEot (temp , eotPath )
472483 report .dedent ()
@@ -477,7 +488,7 @@ def _convertPath(self, path, destDir, saveOTF=True, saveTTF=True, saveWOFF=True,
477488 report .writeTitle ("Build SVG" , "'" )
478489 report .indent ()
479490 report .write ("path: %s" % svgPath )
480- buildTree (fontDir )
491+ buildTree (svgDir )
481492 message = convertToSVG (path , svgPath )
482493 if message :
483494 report .indent ()
0 commit comments