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

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