a
    w=ic	  ã                   @   s<   d dl mZ d dlmZ ddgZG dd„ deƒZdd„ ZdS )é    )Úpairwise)ÚContourFilterPenÚreversedContourÚReverseContourPenc                   @   s   e Zd ZdZdd„ ZdS )r   a  Filter pen that passes outline data to another pen, but reversing
    the winding direction of all contours. Components are simply passed
    through unchanged.

    Closed contours are reversed in such a way that the first point remains
    the first point.
    c                 C   s   t |ƒS ©N)r   )ÚselfÚcontour© r	   úq/home/droni/.local/share/virtualenvs/DPS-5Je3_V2c/lib/python3.9/site-packages/fontTools/pens/reverseContourPen.pyÚfilterContour   s    zReverseContourPen.filterContourN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r	   r	   r	   r
   r      s   c                 c   s  | sdS t | ƒdksJ dƒ‚|  ¡ d }|dv s4J ‚|dk}|  d¡\}}|dv s^J d| ƒ‚|d	 }|d
kr¬|du s~J dƒ‚| rŠJ dƒ‚|d ftt|dd	… ƒƒ d }| sÐ|dkr¾d}nd}||fV  n*| d	 \}}|d	 }|rŒ||fV  ||kr(d|ffV  |t|dd	… ƒ|f f| d	< t | ƒdkrD| d \}	}
n
|| }	}
|	dkr¶||
kr¶| d= | r¶|t|dd	… ƒ|
 f| d	< n*||ffV  |t|dd	… ƒ|f f| d	< t| ddD ]6\\}}\}}|tt|dd	… ƒƒ|d	 f fV  qÂ|rdnddfV  dS )z€ Generator that takes a list of pen's (operator, operands) tuples,
    and yields them with the winding direction reversed.
    Né   zinvalid contourr   )ÚendPathÚ	closePathr   )ÚmoveToÚqCurveToz invalid initial segment type: %réÿÿÿÿr   z)off-curve only paths must end with 'None'z,only one qCurveTo allowed per off-curve pathr   r   FTZlineTo)Úreverser   r	   )ÚlenÚpopÚtupleÚreversedr   )r   ZcontourTypeÚclosedZ	firstTypeZfirstPtsZfirstOnCurveZlastTypeZlastPtsZlastOnCurveZ
secondTypeZ	secondPtsZcurTypeZcurPtsÚ_ZnextPtsr	   r	   r
   r      sf    
ÿ
ÿÿÿ

ÿ
ÿ
ÿ(N)ZfontTools.misc.arrayToolsr   ZfontTools.pens.filterPenr   Ú__all__r   r   r	   r	   r	   r
   Ú<module>   s   