This does what I want it to with the glyphs I pass to it (puts a fattened version in the second layer), but it also runs the offset curve filter on all other glyphs. What am I doing wrong?
def filter(name):
for filter in Glyphs.filters:
if filter.__class__.__name__ == name:
return filter
def setUpBase(baseGlyph):
#replace 2nd layer with copy of first
preserveLayer = font.glyphs[baseGlyph].layers[0].copy()
print("preserve layer:", preserveLayer)
thisLayer = font.glyphs[baseGlyph].layers[font.masters[1].id]
offsetCurveFilter = filter('GlyphsFilterOffsetCurve')
offsetCurveFilter.processFont_withArguments_(font, ['GlyphsFilterOffsetCurve', '100', '100', '0', '0.5', 'include: %s' %baseGlyph])
font.glyphs[baseGlyph].layers[0].removeOverlap()
outlineLayer = font.glyphs[baseGlyph].layers[0].copy()
outlineLayer.layerId = font.masters[1].id
font.glyphs[baseGlyph].layers[font.masters[1].id] = outlineLayer
font.glyphs[baseGlyph].layers[0] = preserveLayer
(Both are in a for path in Layer.paths: loop, and are preceded by offsetCurveFilter = objc.lookUpClass("GlyphsFilterOffsetCurve") and from AppKit import NSButtLineCapStyle )