build: minor performance optimization of fontbuild
This commit is contained in:
parent
00815d1b99
commit
b57ca872d0
2 changed files with 16 additions and 13 deletions
|
|
@ -62,9 +62,9 @@ class FontProject:
|
||||||
self.builddir = "out"
|
self.builddir = "out"
|
||||||
self.decompose = self.config.get("glyphs","decompose").split()
|
self.decompose = self.config.get("glyphs","decompose").split()
|
||||||
self.predecompose = self.config.get("glyphs","predecompose").split()
|
self.predecompose = self.config.get("glyphs","predecompose").split()
|
||||||
self.lessItalic = self.config.get("glyphs","lessitalic").split()
|
self.lessItalic = set(self.config.get("glyphs","lessitalic").split())
|
||||||
self.deleteList = self.config.get("glyphs","delete").split()
|
self.deleteList = set(self.config.get("glyphs","delete").split())
|
||||||
self.noItalic = self.config.get("glyphs","noitalic").split()
|
self.noItalic = set(self.config.get("glyphs","noitalic").split())
|
||||||
|
|
||||||
self.buildOTF = False
|
self.buildOTF = False
|
||||||
self.compatible = False
|
self.compatible = False
|
||||||
|
|
@ -89,11 +89,13 @@ class FontProject:
|
||||||
|
|
||||||
n = names.split("/")
|
n = names.split("/")
|
||||||
log("---------------------\n%s %s\n----------------------" %(n[0],n[1]))
|
log("---------------------\n%s %s\n----------------------" %(n[0],n[1]))
|
||||||
|
|
||||||
if isinstance( mix, Mix):
|
if isinstance( mix, Mix):
|
||||||
log(">> Mixing masters")
|
log(">> Mixing masters")
|
||||||
f = mix.generateFont(self.basefont)
|
f = mix.generateFont(self.basefont, self.deleteList)
|
||||||
else:
|
else:
|
||||||
f = mix.copy()
|
f = mix.copy()
|
||||||
|
deleteGlyphs(f, self.deleteList)
|
||||||
|
|
||||||
if italic == True:
|
if italic == True:
|
||||||
log(">> Italicizing")
|
log(">> Italicizing")
|
||||||
|
|
@ -166,7 +168,7 @@ class FontProject:
|
||||||
|
|
||||||
if not self.compatible:
|
if not self.compatible:
|
||||||
cleanCurves(f)
|
cleanCurves(f)
|
||||||
deleteGlyphs(f, self.deleteList)
|
# deleteGlyphs(f, self.deleteList)
|
||||||
|
|
||||||
log(">> Generating font files")
|
log(">> Generating font files")
|
||||||
ufoName = self.generateOutputPath(f, "ufo")
|
ufoName = self.generateOutputPath(f, "ufo")
|
||||||
|
|
|
||||||
|
|
@ -284,10 +284,11 @@ class Mix:
|
||||||
ffont.kerning = self.mixKerns()
|
ffont.kerning = self.mixKerns()
|
||||||
return ffont
|
return ffont
|
||||||
|
|
||||||
def generateFont(self, baseFont):
|
def generateFont(self, baseFont, ignoreGlyphs=None):
|
||||||
newFont = baseFont.copy()
|
newFont = baseFont.copy()
|
||||||
#self.mixStems(newFont) todo _ fix stems code
|
#self.mixStems(newFont) todo _ fix stems code
|
||||||
for g in newFont:
|
for g in newFont:
|
||||||
|
if not ignoreGlyphs or g.name not in ignoreGlyphs:
|
||||||
gF = self.mixGlyphs(g.name)
|
gF = self.mixGlyphs(g.name)
|
||||||
if gF == None:
|
if gF == None:
|
||||||
g.mark = True
|
g.mark = True
|
||||||
|
|
|
||||||
Reference in a new issue