def _endPath(self): self.writer_pen.endPath() def addComponent(self, baseGlyphName, transformation): pass source = CurrentGlyph() # Save the anchors from the original glyph in a list anchors = [a for a in source.anchors] # Remove all anchors from the glyph so they don't interfere with our processing for a in anchors: source.removeAnchor(a) # Temporary glyph to which the pen is writing target = RGlyph() target_pen = target.getPen() source_pen = MyPen(CurrentFont(), target_pen, 10) source.draw(source_pen) # Clear the original glyph and add the modfied outline source.clear(components=False) source.appendGlyph(target) # Restore the saved anchors for a in anchors: source.appendAnchor(a.name, a.position)