+
    i2                         ^ RI t ^ RIHtHt ^ RIHt ^ RIHt ^ RIH	t	 ^ RI
Ht ^ RI
Ht  ! R R	]4      t ! R
 R]4      t ! R R4      tR# )    N)curve_to_quadraticcurves_to_quadratic)decomposeSuperBezierSegment)	FilterPen)ReverseContourPen)BasePointToSegmentPen)ReverseContourPointPenc                   L   a a ] tR t^t oRtRV 3R lltV 3R ltR tRtVt	V ;t
# )Cu2QuPena  A filter pen to convert cubic bezier curves to quadratic b-splines
using the FontTools SegmentPen protocol.

Args:

    other_pen: another SegmentPen used to draw the transformed outline.
    max_err: maximum approximation error in font units. For optimal results,
        if you know the UPEM of the font, we recommend setting this to a
        value equal, or close to UPEM / 1000.
    reverse_direction: flip the contours' direction but keep starting point.
    stats: a dictionary counting the point numbers of quadratic segments.
    all_quadratic: if True (default), only quadratic b-splines are generated.
        if False, quadratic curves or cubic curves are generated depending
        on which one is more economical.
c                p   < V'       d   \        V4      p\        SV `	  V4       W n        W@n        WPn        R # N)r   super__init__max_errstatsall_quadratic)self	other_penr   reverse_directionr   r   	__class__s   &&&&&&w/Users/tonyclaw/.openclaw/workspace/skills/math-calculator/venv/lib/python3.14/site-packages/fontTools/pens/cu2quPen.pyr   Cu2QuPen.__init__)   s/     ))4I#
*    c                  < V P                   WV3p\        W@P                  V P                  4      pV P                  eL   \        \        V4      ^,
          4      pV P                  P                  V^ 4      ^,           V P                  V&   V P                  '       d   V P                  ! VR,          !   R # \        V4      ^8X  d   V P                  ! VR,          !   R # \        V4      ^8X  g   Q h\        SV `(  ! VR,          !   R # )N   NN)
current_ptr   r   r   r   strlengetqCurveTor   curveTo)r   pt1pt2pt3curveresultnr   s   &&&&   r   _convert_curveCu2QuPen._convert_curve8   s    #C0#E<<9K9KL::!CK!O$A JJNN1a014DJJqMMM6":&6{avbz*6{a''',r   c                    \        V4      pV^8X  d   V P                  ! V!   R# V^8  d%   \        V4       F  pV P                  ! V!   K  	  R# V P                  ! V!   R# )   N)r   r)   r   r!   )r   pointsr(   segments   &*  r   r"   Cu2QuPen.curveToG   sR    K6(U6v>##W- ? MM6"r   )r   r   r   FNT)__name__
__module____qualname____firstlineno____doc__r   r)   r"   __static_attributes____classdictcell____classcell__)r   __classdict__s   @@r   r   r      s      +-	# 	#r   r   c            	          a  ] tR t^St o RtR^]P                  3R^]P                  3R^]P                  3R^]P                  3/tRR lt	R t
R	 tR
 tR tRtV tR# )Cu2QuPointPena  A filter pen to convert cubic bezier curves to quadratic b-splines
using the FontTools PointPen protocol.

Args:
    other_point_pen: another PointPen used to draw the transformed outline.
    max_err: maximum approximation error in font units. For optimal results,
        if you know the UPEM of the font, we recommend setting this to a
        value equal, or close to UPEM / 1000.
    reverse_direction: reverse the winding direction of all contours.
    stats: a dictionary counting the point numbers of quadratic segments.
    all_quadratic: if True (default), only quadratic b-splines are generated.
        if False, quadratic curves or cubic curves are generated depending
        on which one is more economical.
movelineqcurver&   Nc                    \         P                  ! V 4       V'       d   \        V4      V n        MWn        W n        W@n        WPn        R # r   )r   r   r	   penr   r   r   )r   other_point_penr   r   r   r   s   &&&&&&r   r   Cu2QuPointPen.__init__j   s6     	&&t,-o>DH&H
*r   c           	        \        V4      ^8  g   Q hV^ ,          ^ ,          R8g  p. pVR,          ^,          pVR,          ^ ,          pV EFy  w  rgVR8X  EdJ   V P                  V4       EF0  pVR,          w  rrV^ ,          ^ ,          V^,          ^ ,          rW]W.p\        WP                  V P                  4      pV P
                  eL   \        \        V4      ^,
          4      pV P
                  P                  V^ 4      ^,           V P
                  V&   V^R  Uu. uF	  pVRR/ 3NK  	  ppVP                  WW34       V P                  '       g   \        V4      ^8X  d   VP                  RV.4       MVP                  RV.4       VR,          ^ ,          pEK3  	  EKW  VP                  Wg.4       VR,          ^ ,          pEK|  	  V'       d   VRR VRR ,           pV P                  V4       R# u upi )r   r<   r&   NFr>   )
r   _split_super_bezier_segmentsr   r   r   r   r   r    append_drawPoints)r   segmentsclosednew_segmentsprev_pointsprev_on_curvesegment_typer-   
sub_pointson_curvesmoothnamekwargsbcp1bcp2cubicquadr(   pt
new_pointss   &&                  r   _flushContourCu2QuPointPen._flushContour{   s   8}!!!!Q6)rl1o#B*$, Lw&"&"C"CF"KJ5?^2Hd!+Aq!1:a=3C$*$AE-e\\4CUCUVDzz-D	A.(,

q!(<q(@

1BFq*!M*B2udB"7*J!M%%x&FG)))S_-A$++Xz,BC$++Wj,AB$.rN1$5M #L  ##\$:; &r
1' %-(  (,|CR/@@L& "Ns   G2c                   . p\        V4      ^,
          pV^8X  d   VP                  V4       V# V^8  d   VR,          w  rErgV^,
          p\        \        V U	U
u. uF	  w  p	  qNK  	  up
p	4      4       Fv  w  r. pVRR  F  pVP                  VRR/ 34       K  	  W^,
          8X  d   VP                  WEWg34       MVP                  VR,          RR/ 34       VP                  V4       Kx  	  V# \	        RV,          4      hu up
p	i )r   NFTz$expected 2 control points, found: %drD   )r   rF   	enumerater   AssertionError)r   r-   sub_segmentsr(   rO   rP   rQ   rR   num_sub_segmentsrW   _irN   new_segmentpoints   &&             r   rE   *Cu2QuPointPen._split_super_bezier_segments   s   K!O6'( ' U-3BZ*Hd 1u!*+6,J6KB1aR6,JK" !'_E&&udB'?@ -A-.&&$'GH  &&
2dB'GH##K0"  !!G!!KLL -Ks   Dc           
     P   V P                   pVP                  4        . pV P                  p\        V4       F  w  pw  rgWd9   d   WF,          w  rV	! \	        V4      V4      '       g   Q R V: RV R\	        V4       24       hVRR p
V^ 8X  d   T
pM!V
 F  w  rrVP
                  ! VRW3/ VB  K  	  VR,          w  rrVf   VR8X  g   Q hK  VP
                  ! WW3/ VB  K  \        RV,          4      h	  V F  w  rrVP
                  ! VRW3/ VB  K  	  VP                  4        R# )zillegal z segment point count: expected z, got Nr>   zunexpected segment type: %rrD   )r@   	beginPath_Cu2QuPointPen__points_requiredr\   r   addPointr]   endPath)r   rH   r@   last_offcurvespoints_requiredra   rM   r-   r(   op	offcurvesrW   rP   rQ   rR   s   &&             r   rG   Cu2QuPointPen._drawPoints   sB   hh00)28)<%A%.'5#f+q)) |. /  !s&V7) #3BK	6 &/N4=0DRvFvF 5>+1":(D:'8333 LL6J6J$%B\%QRR3 *=4 )7$BLLT6:6: )7r   c                \    V P                   e   Q hV P                  P                  W4       R # r   )currentPathr@   addComponent)r   baseGlyphNametransformations   &&&r   rq   Cu2QuPointPen.addComponent   s&    '''m<r   )r   r   r@   r   r0   )r1   r2   r3   r4   r5   operatoreqgerg   r   rY   rE   rG   rq   r6   r7   r9   s   @r   r;   r;   S   sl       	HKK HKK 1hkk"!X[[!	+"'B8!F= =r   r;   c                   p   a  ] tR t^t o RtRR ltR tR tR tR t	R t
R tR	 tR
 tR tR tR tRtV tR# )Cu2QuMultiPena  A filter multi-pen to convert cubic bezier curves to quadratic b-splines
in a interpolation-compatible manner, using the FontTools SegmentPen protocol.

Args:

    other_pens: list of SegmentPens used to draw the transformed outlines.
    max_err: maximum approximation error in font units. For optimal results,
        if you know the UPEM of the font, we recommend setting this to a
        value equal, or close to UPEM / 1000.
    reverse_direction: flip the contours' direction but keep starting point.

This pen does not follow the normal SegmentPen protocol. Instead, its
moveTo/lineTo/qCurveTo/curveTo methods take a list of tuples that are
arguments that would normally be passed to a SegmentPen, one item for
each of the pens in other_pens.
c                    V'       d   V Uu. uF  p\        VR R7      NK  	  ppWn        W n        RV n        RV n        R# u upi )T)outputImpliedClosingLineN)r   pensr   	start_ptscurrent_pts)r   
other_pensr   r   r@   s   &&&& r   r   Cu2QuMultiPen.__init__   sN     &%C "#E%   	s   Ac                8    V P                   f   \        R4      hR # )NzmoveTo is requiredr   r]   r   s   &r   _check_contour_is_open$Cu2QuMultiPen._check_contour_is_open   s    # !566 $r   c                8    V P                   e   \        R4      hR # )Nz closePath or endPath is requiredr   r   s   &r   _check_contour_is_closed&Cu2QuMultiPen._check_contour_is_closed  s    ' !CDD (r   c                    V P                   eC   \        V P                   V P                  4       F  w  rVP                  ! V!   K  	  R V n         R # R # r   )r~   zipr}   moveTo)r   rW   r@   s   &  r   _add_moveToCu2QuMultiPen._add_moveTo  s>    >>%t~~tyy9

B :!DN &r   c                b    V P                  4        V;V n        V n        V P                  4        R # r   )r   r~   r   r   )r   ptss   &&r   r   Cu2QuMultiPen.moveTo  s)    %%',//)r   c                    V P                  4        V P                  4        \        WP                  4       F  w  r#VP                  ! V!   K  	  Wn        R # r   )r   r   r   r}   lineTor   )r   r   rW   r@   s   &&  r   r   Cu2QuMultiPen.lineTo  s@    ##%3		*GBJJO +r   c                p   V P                  4        \        V^ ,          4      ^8X  d+   T P                  V Uu. uF  q"^ ,          3NK  	  up4       R# V P                  4        . p\	        WP
                  4       F.  w  r$VP                  ! V!   VP                  VR,          34       K0  	  W0n        R# u upi )r   NrD   )	r   r   r   r   r   r}   r!   rF   r   )r   
pointsListr-   r   r@   s   &&   r   r!   Cu2QuMultiPen.qCurveTo  s    ##%z!}"KKJ?J&)J?@z995KFLL&!r
}- 6 ' @s   B3c                *   . p\        V P                  V4       F  w  r4VP                  W4,           4       K  	  \        W P                  .\        V4      ,          4      p. pV F  pVP                  VR ,          4       K  	  V P                  V4       R# )r   N)r   r   rF   r   r   r   r!   )r   r   curvesr   r-   
quadratics	quadratics   &&     r   _curves_to_quadratic"Cu2QuMultiPen._curves_to_quadratic&  sw    "%d&6&6
"CJMM*-. #D(,,#f+1MN

#Iim, $j!r   c                H    V P                  4        V P                  V4       R # r   )r   r   )r   r   s   &&r   r"   Cu2QuMultiPen.curveTo0  s    ##%!!*-r   c                    V P                  4        V P                  f$   V P                   F  pVP                  4        K  	  R ;V n        V n        R # r   )r   r~   r}   	closePathr   r   r@   s   & r   r   Cu2QuMultiPen.closePath4  s>    ##%>>!yy !,004>r   c                    V P                  4        V P                  f$   V P                   F  pVP                  4        K  	  R ;V n        V n        R # r   )r   r~   r}   ri   r   r   s   & r   ri   Cu2QuMultiPen.endPath;  s>    ##%>>!yy !,004>r   c                    V P                  4        \        W P                  4       F  w  r4VP                  W4       K  	  R # r   )r   r   r}   rq   )r   	glyphNametransformationstransr@   s   &&&  r   rq   Cu2QuMultiPen.addComponentB  s1    %%'oyy9JEY. :r   )r   r   r}   r~   N)F)r1   r2   r3   r4   r5   r   r   r   r   r   r   r!   r   r"   r   ri   rq   r6   r7   rx   s   @r   rz   rz      sL     (	 7E"

'".11/ /r   rz   )ru   fontTools.cu2qur   r   fontTools.pens.basePenr   fontTools.pens.filterPenr    fontTools.pens.reverseContourPenr   fontTools.pens.pointPenr   r	   r   r;   rz    r   r   <module>r      sE     C > . > 9 :8#y 8#vJ=) J=Ze/ e/r   