morphologic
clone your own copy | download snapshot

Snapshots | iceberg

Inside this repository

make_curves_straight.py
text/x-python

Download raw (608 bytes)

# Removes all control points, so that there are no
# curves anymore only straight lines

from robofab.world import CurrentFont

font = CurrentFont()

for g in [glyph.name for glyph in font]:
    old = font[g]
    print len(old)
    new = font.newGlyph("dummytmp", clear=True)
    
    pen = new.getPointPen()
    for contour in old:
        pen.beginPath()
        for point in contour.points:
            if point.type != "offCurve":
                pen.addPoint((point.x,point.y),"line")
        pen.endPath()
    
    font.newGlyph(g, clear=True)
    old.appendGlyph(new)
    print len(new)

font.update()