allHits = {} for index, pts in self.hits.items(): unique = list(Set(pts)) unique.sort() allHits[index] = unique return allHits def getAll(self): """Get all the slices.""" allHits = [] for index, pts in self.hits.items(): allHits.extend(pts) unique = list(Set(allHits)) unique = list(unique) unique.sort() return unique if __name__ == "__main__": from robofab.world import CurrentGlyph, CurrentFont f = CurrentFont() g = CurrentGlyph() pt = (74, 216) pen = MarginPen(f, pt[1], isHorizontal=False) g.draw(pen) print 'glyph Y margins', pen.getMargins() print pen.getContourMargins()
for index, pts in self.hits.items(): unique = list(Set(pts)) unique.sort() allHits[index] = unique return allHits def getAll(self): """Get all the slices.""" allHits = [] for index, pts in self.hits.items(): allHits.extend(pts) unique = list(Set(allHits)) unique = list(unique) unique.sort() return unique if __name__ == "__main__": from robofab.world import CurrentGlyph, CurrentFont f = CurrentFont() g = CurrentGlyph() pt = (74, 216) pen = MarginPen(f, pt[1], isHorizontal=False) g.draw(pen) print 'glyph Y margins', pen.getMargins() print pen.getContourMargins()
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 ...