summaryrefslogtreecommitdiff
path: root/scripts/lib/fontbuild/decomposeGlyph.py
blob: a0989687d84e11e795a7b9fecda4e170fd9a3271 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
def decomposeGlyph(glyph):
    """Moves the components of a glyph to its outline."""

    font = glyph.getParent()
    for component in glyph.components:
        componentGlyph = font[component.baseGlyph]
        for contour in componentGlyph:
            contour = contour.copy()
            contour.move(component.offset)
            contour.scale(component.scale)
            glyph.appendContour(contour)
    glyph.clear(contours=False, anchors=False, guides=False)