
    h9                     h    S SK JrJrJr  S SKJrJr  S SKJr  SS/r	 " S S\5      r
 " S S\
5      rg)	    )updateBoundspointInRect	unionRect)calcCubicBoundscalcQuadraticBounds)BasePen	BoundsPenControlBoundsPenc                   F    \ rS rSrSrSS jrS rS rS rS r	S r
S	 rS
rg)r
   	   a  Pen to calculate the "control bounds" of a shape. This is the
bounding box of all control points, so may be larger than the
actual bounding box if there are curves that don't have points
on their extremes.

When the shape has been drawn, the bounds are available as the
``bounds`` attribute of the pen object. It's a 4-tuple::

        (xMin, yMin, xMax, yMax).

If ``ignoreSinglePoints`` is True, single points are ignored.
c                 \    [         R                  " X5        X l        U R                  5         g N)r   __init__ignoreSinglePointsinit)selfglyphSetr   s      J/var/www/html/env/lib/python3.13/site-packages/fontTools/pens/boundsPen.pyr   ControlBoundsPen.__init__   s    ("4		    c                      S U l         S U l        g r   )bounds_start)r   s    r   r   ControlBoundsPen.init   s    r   c                 T    Xl         U R                  (       d  U R                  5         g g r   )r   r   
_addMoveTor   pts     r   _moveToControlBoundsPen._moveTo    s    &&OO 'r   c                     U R                   c  g U R                  nU(       a  [        XR                   5      U l        OU R                   u  p#X#X#4U l        S U l         g r   )r   r   r   )r   r   xys       r   r   ControlBoundsPen._addMoveTo%   sH    ;;&v{{;DK;;DA,DKr   c                 Z    U R                  5         [        U R                  U5      U l        g r   )r   r   r   r   s     r   _lineToControlBoundsPen._lineTo0   s    "4;;3r   c                     U R                  5         U R                  n[        XA5      n[        XB5      n[        XC5      nX@l        g r   r   r   r   r   bcp1bcp2r   r   s        r   _curveToOneControlBoundsPen._curveToOne4   s8    f+f+f)r   c                 t    U R                  5         U R                  n[        X15      n[        X25      nX0l        g r   r)   r   bcpr   r   s       r   _qCurveToOneControlBoundsPen._qCurveToOne<   s.    f*f)r   )r   r   r   N)F)__name__
__module____qualname____firstlineno____doc__r   r   r   r   r&   r-   r2   __static_attributes__ r   r   r
   r
   	   s*    

	4r   c                   $    \ rS rSrSrS rS rSrg)r	   D   ap  Pen to calculate the bounds of a shape. It calculates the
correct bounds even when the shape contains curves that don't
have points on their extremes. This is somewhat slower to compute
than the "control bounds".

When the shape has been drawn, the bounds are available as the
``bounds`` attribute of the pen object. It's a 4-tuple::

        (xMin, yMin, xMax, yMax)
c           	          U R                  5         U R                  n[        XC5      n[        X5      (       a  [        X$5      (       d%  [	        U[        U R                  5       XU5      5      nX@l        g r   )r   r   r   r   r   r   _getCurrentPointr*   s        r   r-   BoundsPen._curveToOneP   s\    f)4((D0I0I(=(=(?RPF r   c                     U R                  5         U R                  n[        X25      n[        X5      (       d$  [	        U[        U R                  5       X5      5      nX0l        g r   )r   r   r   r   r   r   r>   r0   s       r   r2   BoundsPen._qCurveToOneZ   sQ    f)3''+D,A,A,CSMF r   )r   N)r4   r5   r6   r7   r8   r-   r2   r9   r:   r   r   r	   r	   D   s    	r   N)fontTools.misc.arrayToolsr   r   r   fontTools.misc.bezierToolsr   r   fontTools.pens.basePenr   __all__r
   r	   r:   r   r   <module>rF      s8    J J K * *
+8w 8v  r   