a
    ׶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	   p/Users/vegardjervell/Documents/master/model/venv/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| rJ d|d ftt|dd	  d }| s|dkrd}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: %rr   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   