
    Mcg                         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  cg c]
  }  e|        c} Z
 G d d	e      Zy
c c} w )    )TransformPen)etree)tostr   )
parse_path)PathBuilder)SVGPathr   c                   0    e Zd ZdZddZedd       Zd Zy)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                     |!t        j                         | _        || _        y t        j                  |      }|j	                         | _        || _        y N)r   ElementTreerootparsegetroot	transform)selffilenamer   trees       Y/var/www/html/bid-api/venv/lib/python3.12/site-packages/fontTools/svgLib/path/__init__.py__init__zSVGPath.__init__&   sE    ))+DI # ;;x(DDI"    c                 L     | |      }t        j                  |      |_        |S )N)r   )r   
fromstringr   )clsdatar   r   s       r   r   zSVGPath.fromstring.   s#    Y'$$T*	r   c                 J   | j                   rt        || j                         }t               }| j                  j	                         D ]  }|j                  |        |}t        |j                  |j                        D ]"  \  }}|rt        ||      }n|}t        ||       $ y r   )
r   r   r   r   iteradd_path_from_elementzippaths
transformsr   )r   penpbeloriginal_penpathr   s          r   drawzSVGPath.draw4   s    >>sDNN3C])).."B$$R( #"288R]];OD)"<;"tS!  <r   )NNr   )__name__
__module____qualname____doc__r   classmethodr   r'    r   r   r	   r	      s%    4#  
"r   r	   N)fontTools.pens.transformPenr   fontTools.miscr   fontTools.misc.textToolsr   parserr   shapesr   __all__objectr	   )ss   0r   <module>r6      sA    4   *   7
76586
76"f 6" 8s   A