def to_ufo_components(self, ufo_glyph, layer):
pen = ufo_glyph.getPointPen()<EOL>for index, component in enumerate(layer.components):<EOL><INDENT>pen.addComponent(component.name, component.transform)<EOL>if component.anchor:<EOL><INDENT>if COMPONENT_INFO_KEY not in ufo_glyph.lib:<EOL><INDENT>ufo_glyph.lib[COMPONENT_INFO_KEY] = []<EOL><DEDENT>ufo_glyph.lib[COMPONENT_INFO_KEY].append(<EOL>{"<STR_LIT:name>": component.name, "<STR_LIT:index>": index, "<STR_LIT>": component.anchor}<EOL>)<EOL><DEDENT><DEDENT>for key in ["<STR_LIT>", "<STR_LIT>", "<STR_LIT>"]:<EOL><INDENT>values = [getattr(c, key) for c in layer.components]<EOL>if any(values):<EOL><INDENT>ufo_glyph.lib[_lib_key(key)] = values<EOL><DEDENT><DEDENT>
Draw .glyphs components onto a pen, adding them to the parent glyph.