
    jke                     B    d dl mZ d dlmZ ddgZ G d de      ZddZy)	    )pairwise)ContourFilterPenreversedContourReverseContourPenc                   *     e Zd ZdZd fd	Zd Z xZ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                 2    t         |   |       || _        y N)super__init__outputImpliedClosingLine)selfoutPenr   	__class__s      B/usr/lib/python3/dist-packages/fontTools/pens/reverseContourPen.pyr   zReverseContourPen.__init__   s     (@%    c                 .    t        || j                        S r	   )r   r   )r   contours     r   filterContourzReverseContourPen.filterContour   s    w(E(EFFr   F)__name__
__module____qualname____doc__r   r   __classcell__)r   s   @r   r   r      s    AGr   c           	   #     K   | syt        |       dkD  sJ d       | j                         d   }|dv sJ |dk(  }| j                  d      \  }}|dv s
J d|z         |d	   }|d
k(  r3|J d       | rJ d       |d   ft        t        |dd	             z   dz   }| s|dk(  rd}nd}||f n| d	   \  }}|d	   }	|rl||f ||	k7  rd|	ff |t        |dd	       |fz   f| d	<   t        |       dkD  r	| d   \  }
}n||}}
|sD|
dk(  r?||k7  r:| d= | r5|t        |dd	       |z   f| d	<   n||	ff |t        |dd	       |fz   f| d	<   t	        | d      D ]-  \  \  }}\  }}|t        t        |dd	             |d	   fz   f / |rdnddf yw)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   FTlineTo)reverser    )lenpoptuplereversedr   )r   r   contourTypeclosed	firstTypefirstPtsfirstOnCurvelastTypelastPtslastOnCurve
secondType	secondPtscurTypecurPts_nextPtss                   r   r   r      sD      w<!... ++-"K2222K'F!++a.Ix.. *Y6. B<LJ#P%PP#JJJ{QK>E(8Ab>*B$CCgM FF!!#BK'bkX%%{*..'ws|)<)NO7|a(/
%
I )1'I
+
 )h).C
'/ws|1Dy1P&Q k^++#U73B<%8L?%JKGBK
 08/N 	I+Wf|75&"+!6772;.HHH	I  +Y
22s   F
FNr   )fontTools.misc.arrayToolsr   fontTools.pens.filterPenr   __all__r   r   r$   r   r   <module>r:      s-    . 5 1
2G( G"G3r   