o
    _h                     @   s^   d dl mZ d dlmZ d dlmZ ddlmZ ddlm	Z	 dd d	D Z
G d
d deZdS )    )TransformPen)etreetostr   )
parse_path)PathBuilderc                 C   s   g | ]}t |qS  r   ).0sr	   r	   R/var/www/html/myenv/lib/python3.10/site-packages/fontTools/svgLib/path/__init__.py
<listcomp>   s    r   )SVGPathr   c                   @   s0   e Zd ZdZd	ddZed
ddZdd ZdS )r   a  Parse SVG ``path`` elements from a file or string, and draw them
    onto a glyph object that supports the FontTools Pen protocol.

    For example, reading from an SVG file and drawing to a Defcon Glyph:

    .. code-block::

        import defcon
        glyph = defcon.Glyph()
        pen = glyph.getPen()
        svg = SVGPath("path/to/a.svg")
        svg.draw(pen)

    Or reading from a string containing SVG data, using the alternative
    'fromstring' (a class method):

    .. code-block::

        data = '<?xml version="1.0" ...'
        svg = SVGPath.fromstring(data)
        svg.draw(pen)

    Both constructors can optionally take a 'transform' matrix (6-float
    tuple, or a FontTools Transform object) to modify the draw output.
    Nc                 C   s2   |d u r
t  | _n
t |}| | _|| _d S N)r   ElementTreerootparsegetroot	transform)selffilenamer   treer	   r	   r   __init__&   s
   


zSVGPath.__init__c                 C   s   | |d}t ||_|S )N)r   )r   
fromstringr   )clsdatar   r   r	   r	   r   r   .   s   
zSVGPath.fromstringc                 C   sp   | j r	t|| j }t }| j D ]}|| q|}t|j|jD ]\}}|r.t||}n|}t	|| q"d S r   )
r   r   r   r   iteradd_path_from_elementzippaths
transformsr   )r   penpbeloriginal_penpathr   r	   r	   r   draw4   s   zSVGPath.draw)NNr   )__name__
__module____qualname____doc__r   classmethodr   r&   r	   r	   r	   r   r      s    
r   N)fontTools.pens.transformPenr   fontTools.miscr   fontTools.misc.textToolsr   parserr   shapesr   __all__objectr   r	   r	   r	   r   <module>   s    