
    <`	                     H    d dl mZ d dlmZ ddgZ G d de          Zd ZdS )    )pairwise)ContourFilterPenreversedContourReverseContourPenc                       e Zd ZdZ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                      t          |          S N)r   )selfcontours     @lib/python3.11/site-packages/fontTools/pens/reverseContourPen.pyfilterContourzReverseContourPen.filterContour   s    w'''    N)__name__
__module____qualname____doc__r    r   r   r   r      s-         ( ( ( ( (r   c           	   #     K   | sdS t          |           dk    s
J d            |                                 d         }|dv sJ |dk    }|                     d          \  }}|dv sJ d|z              |d	         }|d
k    rI|
J d            | r
J d            |d         ft          t          |dd	                             z   dz   }| 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z   f| d	<   t          |           dk    r| d         \  }	}
n||}
}	|	dk    r*||
k    r$| d= | r|t          |dd	                   |
z   f| d	<   n'||ffV  |t          |dd	                   |fz   f| d	<   t	          | d          D ]=\  \  }}\  }}|t          t          |dd	                             |d	         fz   fV  >|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   FTlineTo)reverser   r   )lenpoptuplereversedr   )r   contourTypeclosed	firstTypefirstPtsfirstOnCurvelastTypelastPtslastOnCurve
secondType	secondPtscurTypecurPts_nextPtss                  r   r   r      s        w<<!. ++--"K22222K'F!++a..Ix....*Y6 /..B<LJ##7 $## 	< 	<:	< 	< 	<a[NU8HQrTN+C+C%D%DD  +I  FFF!!!!!#BK'bk 	LX%%%%{**....'$WSbS\22l_DF 7||a(/
%
II )1'I

 X%%(i*?*?AJ D#+#("#6#6#B#DGBK k^++++#U73B3<%8%8L?%JKGBK
 080' 0' 0' 	I 	I+Wf|75&"+!6!67772;.HHHHHH
.++Y
222222r   N)fontTools.misc.arrayToolsr   fontTools.pens.filterPenr   __all__r   r   r   r   r   <module>r2      s    . . . . . . 5 5 5 5 5 5 1
2
( 
( 
( 
( 
(( 
( 
( 
(J3 J3 J3 J3 J3r   