#FLM: Glyph Appender """Add a glyph to the current glyph""" from robofab.world import CurrentFont, CurrentGlyph from robofab.interface.all.dialogs import SelectGlyph glyph = CurrentGlyph() font = CurrentFont() # select a glyph to add selected = SelectGlyph(font) # make sure that we are not trying add the current glyph to itself if selected.name != glyph.name: # preserve the current state try: fl.SetUndo() except: pass # add the selected glyph to the current glyph glyph.appendGlyph(selected) # always update the glyph! glyph.update() # and, just to be safe, update the font... font.update()
def _lineTo(self, pt): self.writer_pen.lineTo(pt) def _curveToOne(self, bcp1, bcp2, pt): self.writer_pen.curveTo(bcp1, bcp2, pt) def _closePath(self): self.writer_pen.closePath() def _endPath(self): self.writer_pen.endPath() def addComponent(self, baseGlyphName, transformation): pass source = CurrentGlyph() # Temporary glyph to which the pen is writing target = RGlyph() target_pen = target.getPen() source_pen = MyPen(CurrentFont(), target_pen) source.draw(source_pen) # Clear the original glyph and add the modfied outline source.clear() source.appendGlyph(target) # You will notice any anchors are converted to stray points ...
#FLM: Glyph Appender """Add a glyph to the current glyph""" from robofab.world import CurrentFont, CurrentGlyph from robofab.interface.all.dialogs import SelectGlyph glyph = CurrentGlyph() font = CurrentFont() # select a glyph to add selected = SelectGlyph(font) # make sure that we are not trying add the current glyph to itself if selected.name != glyph.name: # preserve the current state fl.SetUndo() # add the selected glyph to the current glyph glyph.appendGlyph(selected) # always update the glyph! glyph.update() # and, just to be safe, update the font... font.update()