
    ]Mh9                     v    d dl mZmZmZ d dlmZmZ d dlmZ ddgZ	 G d de          Z
 G d de
          ZdS )	    )updateBoundspointInRect	unionRect)calcCubicBoundscalcQuadraticBounds)BasePen	BoundsPenControlBoundsPenc                   >    e Zd ZdZddZd Zd Zd Zd Zd Z	d	 Z
d
S )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.
    Fc                 f    t          j        | |           || _        |                                  d S N)r   __init__ignoreSinglePointsinit)selfglyphSetr   s      X/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/fontTools/pens/boundsPen.pyr   zControlBoundsPen.__init__   s.    x((("4		    c                 "    d | _         d | _        d S r   )bounds_start)r   s    r   r   zControlBoundsPen.init   s    r   c                 N    || _         | j        s|                                  d S d S r   )r   r   
_addMoveTor   pts     r   _moveTozControlBoundsPen._moveTo    s4    & 	OO	 	r   c                     | j         d S | j        }|rt          || j                   | _        n| j         \  }}||||f| _        d | _         d S r   )r   r   r   )r   r   xys       r   r   zControlBoundsPen._addMoveTo%   sX    ;F 	'&vt{;;DKK;DAqaA,DKr   c                 b    |                                   t          | j        |          | _        d S r   )r   r   r   r   s     r   _lineTozControlBoundsPen._lineTo0   s)    "4;33r   c                     |                                   | j        }t          ||          }t          ||          }t          ||          }|| _        d S r   r   r   r   r   bcp1bcp2r   r   s        r   _curveToOnezControlBoundsPen._curveToOne4   sQ    fd++fd++fb))r   c                     |                                   | j        }t          ||          }t          ||          }|| _        d S r   r#   r   bcpr   r   s       r   _qCurveToOnezControlBoundsPen._qCurveToOne<   sB    fc**fb))r   N)F)__name__
__module____qualname____doc__r   r   r   r   r!   r'   r+    r   r   r
   r
   	   s            
    
	 	 	4 4 4      r   c                       e Zd ZdZd Zd ZdS )r	   a  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           	         |                                   | j        }t          ||          }t          ||          rt          ||          s2t	          |t          |                                 |||                    }|| _        d S r   )r   r   r   r   r   r   _getCurrentPointr$   s        r   r'   zBoundsPen._curveToOneP   s    fb))4(( 	D&0I0I 	(=(=(?(?tRPP F r   c                     |                                   | j        }t          ||          }t          ||          s1t	          |t          |                                 ||                    }|| _        d S r   )r   r   r   r   r   r   r3   r)   s       r   r+   zBoundsPen._qCurveToOneZ   st    fb))3'' 	+D,A,A,C,CS"MM F r   N)r,   r-   r.   r/   r'   r+   r0   r   r   r	   r	   D   s<        	 	      r   N)fontTools.misc.arrayToolsr   r   r   fontTools.misc.bezierToolsr   r   fontTools.pens.basePenr   __all__r
   r	   r0   r   r   <module>r9      s    J J J J J J J J J J K K K K K K K K * * * * * * *
+8 8 8 8 8w 8 8 8v          r   