
    <`                     H   d dl mZmZ ddgZ G d de          Z G d de          Zedk    rsd dlmZ  e ed          d	          Z	e	
                    d
           e	                    d           e	                    dddd
           e	                                 dS dS )    )	FilterPenFilterPointPenTransformPenTransformPointPenc                   R     e Zd ZdZ fdZd Zd Zd Zd Zd Z	d Z
d	 Zd
 Z xZS )r   zePen that transforms all coordinates using a Affine transformation,
	and passes them to another pen.
	c                     t          t          |                               |           t          |d          sddlm}  || }|| _        |j        | _        g | _	        dS )zThe 'outPen' argument is another pen object. It will receive the
		transformed coordinates. The 'transformation' argument can either
		be a six-tuple, or a fontTools.misc.transform.Transform object.
		transformPointr   	TransformN)
superr   __init__hasattrfontTools.misc.transformr   _transformationr	   _transformPoint_stack)selfoutPentransformationr   	__class__s       ;lib/python3.11/site-packages/fontTools/pens/transformPen.pyr   zTransformPen.__init__   sr    
 d$$V,,,	!1	2	2 /111111I~.>'$'6$$+++    c                 `    | j                             |                     |                     d S N)_outPenmoveTor   r   pts     r   r   zTransformPen.moveTo   ,    ,d**2../////r   c                 `    | j                             |                     |                     d S r   )r   lineTor   r   s     r   r!   zTransformPen.lineTo   r   r   c                 J     | j         j        |                     |            d S r   )r   curveTo_transformPointsr   pointss     r   r#   zTransformPen.curveTo    s(    $,--f556666r   c                     |d         "|                      |d d                   d gz   }n|                      |          } | j        j        |  d S )N)r$   r   qCurveTor%   s     r   r)   zTransformPen.qCurveTo#   s[    BZ!!&"+..$766!!&))6$,    r   c                 .    | j         fd|D             S )Nc                 &    g | ]} |          S  r,   ).0r   r	   s     r   
<listcomp>z1TransformPen._transformPoints.<locals>.<listcomp>,   s#    	.	.	...

	.	.	.r   )r   )r   r&   r	   s     @r   r$   zTransformPen._transformPoints*   s%    '.	.	.	.	.v	.	.	..r   c                 8    | j                                          d S r   )r   	closePathr   s    r   r0   zTransformPen.closePath.   s    ,r   c                 8    | j                                          d S r   )r   endPathr1   s    r   r3   zTransformPen.endPath1   s    ,r   c                 p    | j                             |          }| j                            ||           d S r   r   	transformr   addComponent)r   	glyphNamer   s      r   r7   zTransformPen.addComponent4   s6    '11.AA.,I~66666r   )__name__
__module____qualname____doc__r   r   r!   r#   r)   r$   r0   r3   r7   __classcell__r   s   @r   r   r      s             0 0 00 0 07 7 7! ! !/ / /    7 7 7 7 7 7 7r   c                   0     e Zd ZdZ fdZddZd Z xZS )r   a  PointPen that transforms all coordinates using a Affine transformation,
	and passes them to another PointPen.

	>>> from fontTools.pens.recordingPen import RecordingPointPen
	>>> rec = RecordingPointPen()
	>>> pen = TransformPointPen(rec, (2, 0, 0, 2, -10, 5))
	>>> v = iter(rec.value)
	>>> pen.beginPath(identifier="contour-0")
	>>> next(v)
	('beginPath', (), {'identifier': 'contour-0'})
	>>> pen.addPoint((100, 100), "line")
	>>> next(v)
	('addPoint', ((190, 205), 'line', False, None), {})
	>>> pen.endPath()
	>>> next(v)
	('endPath', (), {})
	>>> pen.addComponent("a", (1, 0, 0, 1, -10, 5), identifier="component-0")
	>>> next(v)
	('addComponent', ('a', <Transform [2 0 0 2 -30 15]>), {'identifier': 'component-0'})
	c                     t                                          |           t          |d          sddlm}  || }|| _        |j        | _        dS )zThe 'outPointPen' argument is another point pen object.
		It will receive the transformed coordinates.
		The 'transformation' argument can either be a six-tuple, or a
		fontTools.misc.transform.Transform object.
		r	   r   r
   N)r   r   r   r   r   r   r	   r   )r   outPointPenr   r   r   s       r   r   zTransformPointPen.__init__O   sg     '';	!1	2	2 /111111I~.>'$'6$r   NFc                 X     | j         j        |                     |          |||fi | d S r   )r   addPointr   )r   r   segmentTypesmoothnamekwargss         r   rC   zTransformPointPen.addPoint\   sI    $,[&$ :@    r   c                 b    | j                             |          } | j        j        ||fi | d S r   r5   )r   baseGlyphNamer   rG   s       r   r7   zTransformPointPen.addComponenta   s=    '11.AA.$,M>DDVDDDDDr   )NFN)r9   r:   r;   r<   r   rC   r7   r=   r>   s   @r   r   r   9   sl         *7 7 7 7 7   
E E E E E E Er   __main__)_TestPenN)   r   g      ?rL   ir   )r   r   )r   d   )2   K   )<   rN   )rN      )fontTools.pens.filterPenr   r   __all__r   r   r9   fontTools.pens.basePenrK   penr   r!   r#   r0   r,   r   r   <module>rV      s   > > > > > > > > .
//7 /7 /7 /7 /79 /7 /7 /7d*E *E *E *E *E *E *E *EZ z,,,,,,|HHTNN$:;;FHXx6222 r   