def to_ufo_paths(self, ufo_glyph, layer):
pen = ufo_glyph.getPointPen()<EOL>for path in layer.paths:<EOL><INDENT>nodes = list(path.nodes)<EOL>for node in nodes:<EOL><INDENT>self.to_ufo_node_user_data(ufo_glyph, node)<EOL><DEDENT>pen.beginPath()<EOL>if not nodes:<EOL><INDENT>pen.endPath()<EOL>continue<EOL><DEDENT>if not path.closed:<EOL><INDENT>node = nodes.pop(<NUM_LIT:0>)<EOL>assert node.type == "<STR_LIT>", "<STR_LIT>"<EOL>pen.addPoint(tuple(node.position), segmentType="<STR_LIT>")<EOL><DEDENT>else:<EOL><INDENT>nodes.insert(<NUM_LIT:0>, nodes.pop())<EOL><DEDENT>for node in nodes:<EOL><INDENT>node_type = _to_ufo_node_type(node.type)<EOL>pen.addPoint(<EOL>tuple(node.position), segmentType=node_type, smooth=node.smooth<EOL>)<EOL><DEDENT>pen.endPath()<EOL><DEDENT>
Draw .glyphs paths onto a pen.