1
1
mirror of https://github.com/rsms/inter.git synced 2024-12-28 18:11:30 +03:00

Fix minor bug in fontbuild where certain glyphs composed of multiple shapes would not be expanded & flattened

This commit is contained in:
Rasmus Andersson 2018-01-18 22:47:59 -08:00
parent 2ad426b1e7
commit f7868ac620
2 changed files with 17 additions and 5 deletions

View File

@ -61,7 +61,8 @@ 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 = set(self.config.get("glyphs","predecompose").split())
self.predecompose_auto = 1 # unless 0, automatically populate predecompose
self.lessItalic = set(self.config.get("glyphs","lessitalic").split()) self.lessItalic = set(self.config.get("glyphs","lessitalic").split())
self.deleteList = set(self.config.get("glyphs","delete").split()) self.deleteList = set(self.config.get("glyphs","delete").split())
self.noItalic = set(self.config.get("glyphs","noitalic").split()) self.noItalic = set(self.config.get("glyphs","noitalic").split())
@ -128,6 +129,13 @@ class FontProject:
for gname in swapList: for gname in swapList:
print gname print gname
swapContours(f, gname.replace(swap,""), gname) swapContours(f, gname.replace(swap,""), gname)
if self.predecompose_auto == 1:
self.predecompose_auto = 2
for g in self.basefont:
if len(g.components) > 0:
self.predecompose.add(g.name)
for gname in self.predecompose: for gname in self.predecompose:
if f.has_key(gname): if f.has_key(gname):
decomposeGlyph(f, f[gname]) decomposeGlyph(f, f[gname])
@ -273,6 +281,8 @@ def generateGlyphs(f, glyphNames, glyphList={}):
def cleanCurves(f): def cleanCurves(f):
log(">> Removing overlaps") log(">> Removing overlaps")
for g in f: for g in f:
# if len(g.components) > 0:
# decomposeGlyph(f, g)
removeGlyphOverlap(g) removeGlyphOverlap(g)
# log(">> Mitring sharp corners") # log(">> Mitring sharp corners")
@ -293,8 +303,9 @@ def deleteGlyphs(f, deleteList):
def removeGlyphOverlap(glyph): def removeGlyphOverlap(glyph):
"""Remove overlaps in contours from a glyph.""" """Remove overlaps in contours from a glyph."""
#TODO(jamesgk) verify overlaps exist first, as per library's recommendation #TODO(jamesgk) verify overlaps exist first, as per library's recommendation
manager = BooleanOperationManager()
contours = glyph.contours contours = glyph.contours
if len(contours) > 1:
manager = BooleanOperationManager()
glyph.clearContours() glyph.clearContours()
manager.union(contours, glyph.getPointPen()) manager.union(contours, glyph.getPointPen())

View File

@ -35,7 +35,8 @@ decompose: integral product florin Tbar tbar Hbar hbar Eng eng notequal mu aster
iota lambda ohorn omega phi psi rho sigma sigma1 tau theta uhorn upsilon xi zeta iota lambda ohorn omega phi psi rho sigma sigma1 tau theta uhorn upsilon xi zeta
Aogonek aogonek Eogonek eogonek Uogonek uogonek uni052F Hdesc hdesc Ndesc ndesc Aogonek aogonek Eogonek eogonek Uogonek uogonek uni052F Hdesc hdesc Ndesc ndesc
nbspace uni202F uni205F erev uni2050 nbspace uni202F uni205F erev uni2050
predecompose: uni04B4 uni04B5 dcroat uni040F uni045F uni0490 uni0491 OE oe Oslash oslash predecompose: uni04B4 uni04B5 dcroat uni040F uni045F uni0490 uni0491
OE oe Oslash oslash
uni04A6 uni04A7 uni0492 uni0493 uni04BC uni04BD gamma Ohorn ohorn Uhorn uhorn uni04A6 uni04A7 uni0492 uni0493 uni04BC uni04BD gamma Ohorn ohorn Uhorn uhorn
uni0472 uni0473 pi uni046C uni046D gravesubnosp acutesubnosp tackleftsubnosp uni0472 uni0473 pi uni046C uni046D gravesubnosp acutesubnosp tackleftsubnosp
tackrightsubnosp ringlefthalfsubnosp tackupsubnosp tackdownsubnosp plussubnosp tackrightsubnosp ringlefthalfsubnosp tackupsubnosp tackdownsubnosp plussubnosp