Skip to content

Commit

Permalink
util: use defcon's instantiateGlyphObject to create a new Glyph
Browse files Browse the repository at this point in the history
So that we can keep the sub-elements custom classes. Fixes #363
  • Loading branch information
anthrotype committed Feb 20, 2020
1 parent e405691 commit 2ea4041
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Lib/ufo2ft/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,11 @@ def newGlyph(name):
else:

def newGlyph(name):
g = cls()
g.name = name
return g
# use instantiateGlyphObject() to keep any custom sub-element classes
# https://github.com/googlefonts/ufo2ft/issues/363
g2 = g.layer.instantiateGlyphObject()
g2.name = name
return g2

# copy everything except unused attributes: 'guidelines', 'note', 'image'
glyphSet = obj_type()
Expand Down

0 comments on commit 2ea4041

Please sign in to comment.