docstamp/svg_fonts.py
def _embed_font_to_svg(filepath, font_files):
    """ Return the ElementTree of the SVG content in `filepath`
    with the font content embedded.
    """
    with open(filepath, 'r') as svgf:
        tree = etree.parse(svgf)

    if not font_files:
        return tree

    fontfaces = FontFaceGroup()
    for font_file in font_files:
        fontfaces.append(FontFace(font_file))

    for element in tree.iter():
        if element.tag.split("}")[1] == 'svg':
            break

    element.insert(0, fontfaces.xml_elem)

    return tree
def _embed_font_to_svg(filepath, font_files):
    with open(filepath, 'r') as svgf:
        tree = etree.parse(svgf)

    if not font_files:
        return tree

    fontfaces = FontFaceGroup()
    for font_file in font_files:
        fontfaces.append(FontFace(font_file))

    for element in tree.iter():
        if element.tag.split("}")[1] == 'svg':
            break

    element.insert(0, fontfaces.xml_elem)

    return tree
def _embed_font_to_svg ( filepath , font_files ) : with open ( filepath , 'r' ) as svgf : tree = etree . parse ( svgf ) if not font_files : return tree fontfaces = FontFaceGroup ( ) for font_file in font_files : fontfaces . append ( FontFace ( font_file ) ) for element in tree . iter ( ) : if element . tag . split ( "}" ) [ 1 ] == 'svg' : break element . insert ( 0 , fontfaces . xml_elem ) return tree
Return the ElementTree of the SVG content in `filepath`
    with the font content embedded.
Return the ElementTree of the SVG content in filepath with the font content embedded .