Skip to content

Commit

Permalink
add Glyph.appendContour method
Browse files Browse the repository at this point in the history
for compat with defcon API (#41)
  • Loading branch information
anthrotype committed Dec 16, 2019
1 parent 6cbb279 commit d89af35
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/ufoLib2/objects/glyph.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from fontTools.pens.pointPen import PointToSegmentPen, SegmentToPointPen

from ufoLib2.objects.anchor import Anchor
from ufoLib2.objects.contour import Contour
from ufoLib2.objects.guideline import Guideline
from ufoLib2.objects.image import Image
from ufoLib2.pointPens.glyphPointPen import GlyphPointPen
Expand Down Expand Up @@ -148,6 +149,13 @@ def appendGuideline(self, guideline):
guideline = Guideline(**guideline)
self._guidelines.append(guideline)

def appendContour(self, contour):
if not isinstance(contour, Contour):
raise TypeError(
f"Expected {Contour.__name__}, found {type(contour).__name__}"
)
self.contours.append(contour)

def copy(self, name=None):
"""Return a new Glyph (deep) copy, optionally override the new glyph name.
"""
Expand Down

0 comments on commit d89af35

Please sign in to comment.