

def renderStrokeAndFill(self, svg_document):
    d = ''
    d += ('M%s\n' % formatSvgPoint(self.renderPath[0].startPoint()))
    for segment in self.renderPath:
        if (len(segment) == 2):
            d += ('L%s\n' % formatSvgPoint(segment.endPoint()))
        elif (len(segment) == 3):
            d += ('Q%s %s\n' % (formatSvgPoint(segment[1]), formatSvgPoint(segment[2])))
        elif (len(segment) == 4):
            d += ('C%s %s %s\n' % (formatSvgPoint(segment[1]), formatSvgPoint(segment[2]), formatSvgPoint(segment[3])))
        else:
            raise Exception('Invalid segment')
    d += 'Z'
    pathArgs = {
        'd': d,
        'fill': 'none',
        'stroke': 'none',
    }
    if (self.fillColor is not None):
        pathArgs['fill'] = formatSvgColor(self.fillColor)
        pathArgs['fill_opacity'] = formatSvgOpacity(self.fillColor)
    if (self.strokeColor is not None):
        pathArgs['stroke'] = formatSvgColor(self.strokeColor)
        pathArgs['stroke_opacity'] = formatSvgOpacity(self.strokeColor)
        pathArgs['stroke_width'] = str(self.strokeWidth)
    svg_document.add(svg_document.path(**pathArgs))

dataset/ETHPy150Open charlesmchen/typefacet-robofont/extension/TypeFacet-RoboFont.roboFontExt/lib/tfs/common/TFSSvg.py TFSSvgPath.renderStrokeAndFill/original