L i9 hddlmZmZmZddlmZmZddlmZddgZ GddeZ Gdde Z y) ) updateBounds pointInRect unionRect)calcCubicBoundscalcQuadraticBounds)BasePen BoundsPenControlBoundsPenc<eZdZdZd dZdZdZdZdZdZ dZ y ) r aPen 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^tj||||_|jyN)r__init__ignoreSinglePointsinit)selfglyphSetrs ^/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/fontTools/pens/boundsPen.pyrzControlBoundsPen.__init__s#x("4 c d|_d|_yr )bounds_start)rs rrzControlBoundsPen.inits  rcL||_|js|jyyr )rr _addMoveTorpts r_moveTozControlBoundsPen._moveTo s! && OO 'rc|jy|j}|r#t||j|_d|_y|j\}}||||f|_d|_yr )rrr)rrxys rrzControlBoundsPen._addMoveTo%s[ ;;   &vt{{;DK ;;DAqaA,DK rcZ|jt|j||_yr )rrrrs r_lineTozControlBoundsPen._lineTo0s "4;;3 rc|j|j}t||}t||}t||}||_yr rrrrbcp1bcp2rrs r _curveToOnezControlBoundsPen._curveToOne4s@ fd+fd+fb) rcz|j|j}t||}t||}||_yr r#rbcprrs r _qCurveToOnezControlBoundsPen._qCurveToOne<s4 fc*fb) rN)F) __name__ __module__ __qualname____doc__rrrrr!r'r+rrr r s*   4rceZdZdZdZdZy)r aPen 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|j}t||}t||r t||s&t |t |j |||}||_yr )rrrrrr_getCurrentPointr$s rr'zBoundsPen._curveToOnePs` fb)4( D&0I(=(=(?tRPF rc|j|j}t||}t||s%t |t |j ||}||_yr )rrrrrrr3r)s rr+zBoundsPen._qCurveToOneZsV fb)3'+D,A,A,CS"MF rN)r,r-r.r/r'r+r0rrr r Ds rN) fontTools.misc.arrayToolsrrrfontTools.misc.bezierToolsrrfontTools.pens.basePenr__all__r r r0rrr9s8JJK* * +8w8v r