a
    w=ic¤
  ã                   @   s\   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„ deƒZ
G dd„ de
ƒZdS )	é    )ÚupdateBoundsÚpointInRectÚ	unionRect)ÚcalcCubicBoundsÚcalcQuadraticBounds)ÚBasePenÚ	BoundsPenÚControlBoundsPenc                   @   sJ   e Zd ZdZddd„Zdd„ Zdd„ Zd	d
„ Zdd„ Zdd„ Z	d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                 C   s   t  | |¡ || _|  ¡  d S ©N)r   Ú__init__ÚignoreSinglePointsÚinit)ÚselfZglyphSetr   © r   úi/home/droni/.local/share/virtualenvs/DPS-5Je3_V2c/lib/python3.9/site-packages/fontTools/pens/boundsPen.pyr      s    zControlBoundsPen.__init__c                 C   s   d | _ d | _d S r
   )ÚboundsÚ_start)r   r   r   r   r      s    zControlBoundsPen.initc                 C   s   || _ | js|  ¡  d S r
   )r   r   Ú
_addMoveTo©r   Úptr   r   r   Ú_moveTo!   s    zControlBoundsPen._moveToc                 C   sJ   | j d u rd S | j}|r(t|| j ƒ| _n| j \}}||||f| _d | _ d S r
   )r   r   r   )r   r   ÚxÚyr   r   r   r   &   s    

zControlBoundsPen._addMoveToc                 C   s   |   ¡  t| j|ƒ| _d S r
   )r   r   r   r   r   r   r   Ú_lineTo1   s    zControlBoundsPen._lineToc                 C   s6   |   ¡  | j}t||ƒ}t||ƒ}t||ƒ}|| _d S r
   ©r   r   r   ©r   Zbcp1Zbcp2r   r   r   r   r   Ú_curveToOne5   s    


zControlBoundsPen._curveToOnec                 C   s,   |   ¡  | j}t||ƒ}t||ƒ}|| _d S r
   r   ©r   Zbcpr   r   r   r   r   Ú_qCurveToOne=   s
    

zControlBoundsPen._qCurveToOneN)F)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r   r   r   r   r   r   r	   	   s   
c                   @   s    e Zd ZdZdd„ Zdd„ ZdS )r   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                 C   sN   |   ¡  | j}t||ƒ}t||ƒr,t||ƒsDt|t|  ¡ |||ƒƒ}|| _d S r
   )r   r   r   r   r   r   Ú_getCurrentPointr   r   r   r   r   R   s    
ÿzBoundsPen._curveToOnec                 C   sB   |   ¡  | j}t||ƒ}t||ƒs8t|t|  ¡ ||ƒƒ}|| _d S r
   )r   r   r   r   r   r   r#   r   r   r   r   r   [   s    


ÿzBoundsPen._qCurveToOneN)r   r    r!   r"   r   r   r   r   r   r   r   E   s   	N)ZfontTools.misc.arrayToolsr   r   r   ZfontTools.misc.bezierToolsr   r   ZfontTools.pens.basePenr   Ú__all__r	   r   r   r   r   r   Ú<module>   s
   <