o
    Ðùa	  ã                   @   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	   úB/usr/lib/python3/dist-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 sJ ‚|dk}|  d¡\}}|dv s0J d| ƒ‚|d	 }|d
krW|du s@J dƒ‚| rFJ dƒ‚|d ftt|dd	… ƒƒ d }| sh|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rŸ| 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 ]\\}}\}}|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      sj   €
ÿ
ÿÿÿ
ÿ
ÿ€ÿ&N)ZfontTools.misc.arrayToolsr   ZfontTools.pens.filterPenr   Ú__all__r   r   r	   r	   r	   r
   Ú<module>   s
    