+
    f7iPN c                   s   R t ^ RIHt ^ RIHt ^ RIHt ^ RIHt ^ RIH	t	 ^ RI
HtHtHt ^ RIHtHt ^ RIHt ^ R	IHtHtHtH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&t&^ RI't'^ RI(t(^ RI)t)^ RI*t*^ RI+t+^ RIH,t, ^ RI-H.t. ^ RI/H0t0 ^ RI1H2t2 ^ RI3H4t4 ^ RI5H6t6 ^ RI7H8t8 ])Pr                  ! ]:4      t;RPy                  ]Pz                  ! R4      R,          4      t^ t> ! R R]$PH                  4      t?]! RR4      t@RtA^tB^tC^tD^tE^tF^ tG^@tH^tI]B]H,           ]I,           tJ^ ^]F^ ]C]F,          ^]CR5]G^ ]D]G,          ^]DR5/tKR tLR tMR  tNR! tOR" tP^tQ^tR^tS^tT^tU^ tV^@tW^tXR#tYR$tZR%t[R&t\R't]]! R(. R6O4      t^ ! R) R*]_4      t`]4! ] P                  ]R+7      tbR, R- ltcR. R/ ltd ! R0 R1]_4      te ! R2 R3]_4      tf]:R48X  d6   ^ RIgtg^ RI&t&]&P                  ! ]gP                  ! 4       P                  4       R# R# )7z6_g_l_y_f.py -- Converter classes for the 'glyf' table.)
namedtuple)sstruct)ttLib)version)DecomposedTransform)tostrsafeEvalpad)updateBoundspointInRect)calcQuadraticBounds)fixedToFloatfloatToFixedfloatToFixedToStrstrToFixedToFloat)noRoundotRound)Vector)Number)DefaultTable)	ttProgramN)	xmlWriter)userNameToFileName)deprecateFunction)IntFlag)partial)SimpleNamespace)Set.N   Nc                   s8  a  ] tR t^8t o RtR.t^tR tR"R ltR t	R"R lt
R tR tR	 tR
 tR tR tR tR t]tR#R ltR tR tR tR tR#R ltR#R]/R lltR#R ltR t]! R]R7      R#R l4       t ]! R]R7      R#R l4       t!]! R]R7      R  4       t"R!t#V t$R# )$table__g_l_y_fa  Glyph Data table

This class represents the `glyf <https://docs.microsoft.com/en-us/typography/opentype/spec/glyf>`_
table, which contains outlines for glyphs in TrueType format. In many cases,
it is easier to access and manipulate glyph outlines through the ``GlyphSet``
object returned from :py:meth:`fontTools.ttLib.ttFont.getGlyphSet`::

                >> from fontTools.pens.boundsPen import BoundsPen
                >> glyphset = font.getGlyphSet()
                >> bp = BoundsPen(glyphset)
                >> glyphset["A"].draw(bp)
                >> bp.bounds
                (19, 0, 633, 716)

However, this class can be used for low-level access to the ``glyf`` table data.
Objects of this class support dictionary-like access, mapping glyph names to
:py:class:`Glyph` objects::

                >> glyf = font["glyf"]
                >> len(glyf["Aacute"].components)
                2

Note that when adding glyphs to the font via low-level access to the ``glyf``
table, the new glyphs must also be added to the ``hmtx``/``vmtx`` table::

                >> font["glyf"]["divisionslash"] = Glyph()
                >> font["hmtx"]["divisionslash"] = (640, 0)

fvarc                s`   R V9   d-   VR ,          P                    Uu. uF  q3P                  NK  	  upM. V n        VR,          p\        V^ ,          4      p^ p^ p/ V n        VP                  4       ;V n        p/ V n        \        ^ \        V4      ^,
          4       Fo  p	 W,          p
\        WI^,           ,          4      pWV p\        V4      We,
          8w  d   \        P                  ! R4      h\        V4      pWP                  V
&   TpKq  	  \        V4      V,
          ^8  d!   \        P                  RV\        V4      4       V'       d   \        P                  RV4       VP                   RJ d   V P#                  4        R# R# u upi   \         d    T^,           pRT	,          p
 ELi ; i)r    locazttxautoglyph%sznot enough 'glyf' table dataz:too much 'glyf' table data: expected %d, received %d bytesz%s glyphs have no nameFN)axesaxisTagaxisTagsintglyphsgetGlyphOrder
glyphOrder_reverseGlyphOrderrangelenZ
IndexErrorr   
TTLibErrorGlyphlogwarningZlazyensureDecompiled)selfdatattFontaxisr!   posZnextPosZnonamer(   i	glyphNameZ	glyphdataglyphs   &&&          F/usr/lib64/python3.14/site-packages/fontTools/ttLib/tables/_g_l_y_f.py	decompileZtable__g_l_y_f.decompile_   s{   >D>NfVn&9&9:&9d\\&9:TV 	 f~$q'l'-';';'==*"$q#d)a-(A1&M	 $1u+&G)I9~'-0&&'EFF)$E%*KK	"C ) t9w!#KKLD	
 KK0&9;;%!!#  = ;  1!,q0	1s   FFF-,F-c                sj    V P                   P                  4        F  pVP                  V 4       K  	  R # N)r&   valuesexpand)r1   Zrecurser8      && r9   r0   Ztable__g_l_y_f.ensureDecompiled   s'     [['')ELL *    c                s   VP                   \        P                  ,          pR V9   d-   VR ,          P                   Uu. uF  q3P                  NK  	  upM. V n        \        V R4      '       g   VP                  4       V n        V P                  p. p^ p. pVP                  p\        4       p	V P                   Fw  p
V P                  V
,          pVP                  V VV	V'       * R7      pV^8  d   \        WR7      pVP                  V4       V\!        V4      ,           pVP                  V4       Ky  	  VP                  V4       V^8X  d   VR8  d   \#        V4       UUu. uF   w  r\!        V4      ^,          ^8X  g   K  VNK"  	  pppV'       dn   V\!        V4      ,           R8  dW   V F  pW};;,          R,          uu&   K  	  ^ p\#        V4       F  w  rWeV&   V\!        V4      ,          pK  	  We\!        V4      &   RP%                  V4      pRV9   d   VR,          P                  V4       RV9   d"   \!        V P                  4      VR,          n        V'       g   RpV# u upi u uppi )	r    r(   )
boundsDoneoptimizeSize)Zsizei   s    r?   r!   Zmaxp)Zcfgr   ZOPTIMIZE_FONT_SPEEDr"   r#   r$   hasattrr'   r(   paddingrecalcBBoxessetr&   compiler   appendr+   	enumeratejoin	numGlyphs)r1   r3   ZoptimizeSpeedr4   rC   Z	locationsZcurrentLocationZdataListrD   r@   r7   r8   Z	glyphDatar6   indicesr2      &&              r9   rF   Ztable__g_l_y_f.compile   s&   

5#<#<= ?E>NfVn&9&9:&9d\\&9:TV 	 t\**$224DO,,	**U
IKK	*E%!..	 & I {	8	_--I>OOOI& ) 	)a<Og5 '0&9&9laS^a=OST=T&9   ?S\9GC AK5(K !"#$-h$7LA#2aL#s9~5O %8 ,;#h-(xx!V6Ny)V'*4;;'7F6N$
 Dk ;:s   I!I&?I&c           
     s|   R pVP                  4       pV'       gB   VP                  4        VP                  V4       VP                  4        VP                  4        \        V4      pV'       d@   \        P
                  P                  VP                  P                  4      w  rx\        4       p	V EF  p
V P                  V
4      pVf   \        P                  RV
4       K1  VP                  '       Ed   V'       Ed   \        \        V
R4      X	XR,           XR7      pV	P!                  VP#                  4       4       \$        P&                  ! VVP(                  VP*                  R7      pVP-                  R\.        R7       VP                  4        VP-                  R	4       VP                  4        VP                  V4       VP                  4        VP1                  R
\        P
                  P3                  V4      R7       MTpVP-                  R
RV
3RVP4                  3RVP6                  3RVP8                  3RVP:                  3.4       VP                  4        VP=                  W4       VP?                  R
4       VP                  4        V'       dS   VP?                  R	4       VP                  4        VP?                  R4       VP                  4        VPA                  4        M<VP1                  R
V
R7       VP                  R4       V'       g   VP                  4        VP                  4        EK  	  R# )zJThe xMin, yMin, xMax and yMax values
will be recalculated by the compiler.Nz'glyph '%s' does not exist in glyf tablezutf-8r   )ZprefixZsuffix)idlefunc
newlinestrr3   )ZttLibVersionZglyfTTGlyph)ZsrcnamexMinyMinxMaxyMax)rP   zcontains no outline data)!ZgetGlyphNamesnewlineZcommentr+   ospathZsplitextZfilerP   rE   getr.   r/   numberOfContoursr   r   addZlowerr   Z	XMLWriterrM   rN   begintagr   	simpletagZbasenamerQ   rR   rS   rT   toXMLendtagZclose)r1   writerr3   ZsplitGlyphsZnoticeZ
glyphNamesrJ   rW   ZextZexistingGlyphFilesr7   r8   Z	glyphPathZglyphWriters   &&&&          r9   r]   Ztable__g_l_y_f.toXML   s   4 	 ))+
NNNN6"NNNN
O	(()9)9:ID!$#IHHY'E}EyQ%%%; 2i1*#cz"	!I '**9??+<="+"5"5!!'#)#4#4#K
  (((H'')((0'')''/'')$$YBGG4D4DY4O$P"(K$$+,,,,	 ##%K0""9-##%&&v.'')&&x0'')%%'   ;9:"NN$NNk $r?   c                s   VR 8w  d   R# \        V R4      '       g   / V n        \        V R4      '       g   VP                  4       V n        VR,          p\        P                  RV4       \        4       pR F(  p\        Wg\        VP                  VR4      4      4       K*  	  W`P                  V&   V F2  p\        V\        4      '       g   K  Vw  rpVP                  WW44       K4  	  VP                  '       g   VP                  V ^ 4       R# R# )rO   Nr&   r(   rP   zunpacking glyph '%s'Z0)rQ   rR   rS   rT   )rB   r&   r'   r(   r.   Zdebugr-   setattrr   rX   
isinstancetuplefromXMLrD   compact)	r1   rP   attrscontentr3   r7   r8   attrelements	   &&&&&    r9   rc   Ztable__g_l_y_f.fromXML	  s    9tX&&DKt\**$224DO&M			()44DE%))D#*>!?@ 5!&IGgu--#* DMM$w7	 
 """MM$" #r?   c                s     Wn         / V n        R# )zVSets the glyph order

Args:
        glyphOrder ([str]): List of glyph names in order.
N)r(   r)   )r1   r(      &&r9   setGlyphOrderZtable__g_l_y_f.setGlyphOrder  s     %"$r?   c                s(    V P                   V,          # )zuReturns the name for the glyph with the given ID.

Raises a ``KeyError`` if the glyph name is not found in the font.
)r(   )r1   glyphIDri   r9   getGlyphNameZtable__g_l_y_f.getGlyphName'  s    
 w''r?   c                s\    / ;V n         p\        V P                  4       F	  w  r#W!V&   K  	  R # r;   )r)   rH   r(   )r1   drk   r7      &   r9   _buildReverseGlyphOrderDictZ*table__g_l_y_f._buildReverseGlyphOrderDict.  s,    &((!"+DOO"<G"iL #=r?   c                s   V P                   p\        V R/ 4      P                  V4      pVe   V\        V4      8  g   W#,          V8w  d,   V P	                  4        V P
                  P                  V4      pVf   \        V4      hV# )zqReturns the ID of the glyph with the given name.

Raises a ``ValueError`` if the glyph is not found in the font.
r)   )r(   getattrrX   r+   ro   r)   
ValueError)r1   r7   r(   Zid   &&  r9   
getGlyphIDZtable__g_l_y_f.getGlyphID3  sw    
 __
T/488C:s:.*.I2M,,.((,,Y7B:Y''	r?   c                sh    V P                   P                  4        F  pVP                  4        K  	  R# )z]Removes TrueType hints from all glyphs in the glyphset.

See :py:meth:`Glyph.removeHinting`.
N)r&   r<   removeHinting)r1   r8      & r9   rt   Ztable__g_l_y_f.removeHintingA  s'    
 [['')E! *r?   c                s6    V P                   P                  4       # r;   )r&   keysr1      &r9   rv   Ztable__g_l_y_f.keysI  s    {{!!r?   c                s    WP                   9   # r;   )r&   r1   r7   ri   r9   has_keyZtable__g_l_y_f.has_keyL  s    KK''r?   Nc                sf    V P                   P                  W4      pVe   VP                  V 4       V# r;   )r&   rX   r=   )r1   r7   Zdefaultr8      &&& r9   rX   Ztable__g_l_y_f.getQ  s+    	3LLr?   c                sN    V P                   V,          pVP                  V 4       V# r;   )r&   r=   r1   r7   r8   r>   r9   __getitem__Ztable__g_l_y_f.__getitem__W  s!    I&Tr?   c                s|    W P                   V&   WP                  9  d   V P                  P                  V4       R # R # r;   )r&   r(   rG   r|      &&&r9   __setitem__Ztable__g_l_y_f.__setitem__\  s/    !&IOO+OO""9- ,r?   c                sV    V P                   V V P                  P                  V4       R # r;   )r&   r(   Zremovery   ri   r9   __delitem__Ztable__g_l_y_f.__delitem__a  s     KK	"y)r?   c                ,    \        V P                  4      # r;   )r+   r&   rw   rx   r9   __len__Ztable__g_l_y_f.__len__e  s    4;;r?   c                s   W,          p\        VR4      '       g   VP                  V 4       W!,          w  rVVP                  V,
          pWu,           pV'       d&   W1,          w  rWP                  ,           pW,
          pM^ ;rV^ 3V^ 3^ V3^ V3.# )a  Compute the four "phantom points" for the given glyph from its bounding box
and the horizontal and vertical advance widths and sidebearings stored in the
ttFont's "hmtx" and "vmtx" tables.

'hMetrics' should be ttFont['hmtx'].metrics.

'vMetrics' should be ttFont['vmtx'].metrics if there is "vmtx" or None otherwise.
If there is no vMetrics passed in, vertical phantom points are set to the zero coordinate.

https://docs.microsoft.com/en-us/typography/opentype/spec/tt_instructing_glyphs#phantoms
rQ   )rB   recalcBoundsrQ   rT   )r1   r7   hMetricsvMetricsr8   horizontalAdvanceWidthleftSideBearing	leftSideX
rightSideXverticalAdvanceWidthtopSideBearingtopSideYbottomSideYs   &&&&         r9   _getPhantomPointsZ table__g_l_y_f._getPhantomPointsi  s     uf%%t$2:2E/JJ0	7
3;3F0 %

2H"9K%&&K NOM	
 	
r?   roundc               s   V P                  V4      pVf   R# VP                  4       '       d   \        VP                   Uu. uF  p\	        VR^ 4      \	        VR^ 4      3NK  	  up4      p\        VP                  \        \        \        VP                  4      4      4      RVP                   Uu. uF  pVP                  \	        VRR4      3NK  	  upR7      pM=VP                  V 4      w  ryp
VP                  4       p\        VP                  V	V
RR7      pV P                  WV4      pVP                  V4       VP                  VR7       Wx3# u upi u upi )aR  Return glyph coordinates and controls as expected by "gvar" table.

The coordinates includes four "phantom points" for the glyph metrics,
as mandated by the "gvar" spec.

The glyph controls is a namedtuple with the following attributes:
        - numberOfContours: -1 for composite glyphs.
        - endPts: list of indices of end points for each contour in simple
        glyphs, or component indices in composite glyphs (used for IUP
        optimization).
        - flags: array of contour point flags for simple glyphs (None for
        composite glyphs).
        - components: list of base glyph names (str) for each component in
        composite glyphs (None for simple glyphs).

The "hMetrics" and vMetrics are used to compute the "phantom points" (see
the "_getPhantomPoints" method).

Return None if the requested glyphName is not present.
Nxy	transform)rY   endPtsflags
componentsr   )rX   isCompositeGlyphCoordinatesr   rp   _GlyphControlsrY   Zlistr*   r+   r7   getCoordinatescopyr   extendtoInt)r1   r7   r   r   r   r8   ccoordsZcontrolsr   r   ZphantomPointss   &&&&$       r9   _getCoordinatesAndControlsZ)table__g_l_y_f._getCoordinatesAndControls  sI   . #=%CHCSCSTCSa'!S!$gaa&89CSTF &!&!7!7E#e&6&6"789 #--- [['![$"?@-	H %*$8$8$>!FE[[]F%!&!7!7	H ..yHMm$5!1 Us   #E0"Ec                s   W,          pVR,          ^ ,          pVR,          ^ ,          pVR,          ^,          pVR,          ^,          p	VRR pVP                  4       '       dC   \        W%P                  4       F(  w  r\        VR4      '       g   K  V
w  Vn        Vn        K*  	  M"VP                  ^ 8X  d   M\        V4      Vn        VP                  V \        4       R7       \        Wv,
          4      pV^ 8  d   ^ p\        VP                  V,
          4      pW3W1&   Ve=   \        W,
          4      pV^ 8  d   ^ p\        WP                  ,
          4      pW3WA&   R# R# )a  Set coordinates and metrics for the given glyph.

"coord" is an array of GlyphCoordinates which must include the "phantom
points" as the last four coordinates.

Both the horizontal/vertical advances and left/top sidebearings in "hmtx"
and "vmtx" tables (if any) are updated from four phantom points and
the glyph's bounding boxes.

The "hMetrics" and vMetrics are used to propagate "phantom points"
into "hmtx" and "vmtx" tables if desired.  (see the "_getPhantomPoints"
method).
Nr   r@   ii)r   zipr   rB   r   r   rY   r   coordinatesr   rE   r   rQ   rT   )r1   r7   coordr   r   r8   r   r   r   r   pZcompr   r   r   r   s   &&&&&           r9   _setCoordinatesZtable__g_l_y_f._setCoordinates  s?     "IaL	2Yq\
9Q<Bilcr
u&6&674%%%&NDFDF 8 ##q( !1 7E4CE2!()?!@!A% &'"!%**y"894E#*8+A#B #a''($$X

%:;N"6"FH  r?   c                s0   \        VP                  R4      RR4      pVfv   VR,          P                  p\        VP                  R4      RR4      pVf
   Ve   TpMTpW,          pVP                  V 4       \	        WgP
                  ,
          4      pWV3/pV# )zzThis method is wrong and deprecated.
For rationale see:
https://github.com/fonttools/fonttools/pull/2266/files#r613569473
vmtxmetricsNZheadZhheaZascent)rp   rX   Z
unitsPerEmr   r   rT   )	r1   r7   r3   defaultVerticalOriginr   r   r   r8   r   s	   &&&&     r9   _synthesizeVMetricsZ"table__g_l_y_f._synthesizeVMetrics  s    
 6::f-y$?#)&>#<#< vzz&18TBH(44H3HOEt$$X

%:;N!.#IJHr?   zuse '_getPhantomPoints' instead)Zcategoryc                p    VR,          P                   pV P                  WV4      pV P                  WV4      # )zcOld public name for self._getPhantomPoints().
See: https://github.com/fonttools/fonttools/pull/2266hmtx)r   r   r   r1   r7   r3   r   r   r      &&&&  r9   getPhantomPointsZtable__g_l_y_f.getPhantomPoints  s9     &>))++I?TU%%i8DDr?   z(use '_getCoordinatesAndControls' insteadc                r   )zlOld public name for self._getCoordinatesAndControls().
See: https://github.com/fonttools/fonttools/pull/2266r   )r   r   r   r   r   r9   getCoordinatesAndControlsZ(table__g_l_y_f.getCoordinatesAndControls  s9     &>))++I?TU..yHMMr?   zuse '_setCoordinates' insteadc                s    VR,          P                   p\        VP                  R4      RR4      pV P                  WV4       R# )zaOld public name for self._setCoordinates().
See: https://github.com/fonttools/fonttools/pull/2266r   r   r   N)r   rp   rX   r   )r1   r7   r3   r   r      &&&  r9   setCoordinatesZtable__g_l_y_f.setCoordinates  s:     &>))6::f-y$?Y(;r?   )r)   r$   r(   r&   Fr;   )%__name__
__module____qualname____firstlineno____doc__ZdependenciesrC   r:   r0   rF   r]   rc   rj   rl   ro   rs   rt   rv   rz   Z__contains__rX   r}   r   r   r   r   r   r   r   r   r   ZDeprecationWarningr   r   r   __static_attributes____classdictcell__Z__classdict__   @r9   r   r   8   s     < 8L G!$F9vDL#*%(#
""( L
.
*  
D4 ;B4 l3Gn( 8CUVE WE 2=ONN 6AST< U<r?   r   r   z(numberOfContours endPts flags componentsz\
		>	# big endian
		numberOfContours:	h
		xMin:				h
		yMin:				h
		xMax:				h
		yMax:				h
c                s   V'       d   \         M^ p^ pV ^ 8X  d   V\        ,          pMFRT u;8:  d   ^8:  d/   M M+V\        ,          pV ^ 8  d   V\        ,          pV^,          pM	V^,          pV^ 8X  d   V\        ,          pW43# RTu;8:  d   ^8:  d1   M M-V\        ,          pV^ 8  d   V\        ,          pV^,          pW43# V^,          pW43# )zFor a given x,y delta pair, returns the flag that packs this pair
most efficiently, as well as the number of byte cost of such flag.)flagOnCurve	flagXsame
flagXShort	flagYsame
flagYShort)r   r   ZonCurveflagcostr   r9   flagBestr   M  s     ";qDDAvi		c	j q5)#D		Avi : 
	c	j q5)#D	 : 		:r?   c                 s    \         W,          ,          p\         W,          ,          pW48H  ;'       g    \        V4      \        V4      8  # r;   )_flagSignBytesZabs)newFlagoldFlagmaskZnewBytesZoldBytesr   r9   flagFitsr   j  s8    gn-Hgn-H@@3x=3x=#@@r?   c                 s    V\         ,          V \         ,          8H  ;'       d?    \        W\        \        ,          4      ;'       d    \        W\        \
        ,          4      # r;   )r   r   r   r   r   r   )r   r   ri   r9   flagSupportsr   p  sK    	;	Gk$9: 	? 	?Wy:'=>	? 	?Wy:'=>r?   c                 s    \         W,          ,          pV^8X  d   VP                  V4       R# VR8X  d   VP                  V) 4       R# V^8X  d)   VP                  \        P                  ! RV4      4       R# R# )   >hNr   )r   rG   r   structpack)r   r   r   
coordBytesZ	byteCounts   &&&& r9   flagEncodeCoordr   x  s_    t{+IA~% 	b5&!	a&++dE23 
r?   c                 sv    \        V \        \        ,          W4       \        V \        \        ,          W$4       R # r;   )r   r   r   r   r   )r   r   r   xBytesyBytess   &&&&&r9   flagEncodeCoordsr     s$    D)j0!<D)j0!<r?      i   i   i   i   CompositeMaxpValuesc                   s  a  ] tR tRt o RtR$R ltR%R ltR tR%RRR	R/R
 lltR t	R t
R&R ltR tR tR tR'R ltR tR	R/R ltR tR tR tRR/R ltRR/R ltR tR]/R ltR tR(R ltR tR'R ltR'R  ltR! tR" t R#t!V t"R# ))r-   i  a  This class represents an individual TrueType glyph.

TrueType glyph objects come in two flavours: simple and composite. Simple
glyph objects contain contours, represented via the ``.coordinates``,
``.flags``, ``.numberOfContours``, and ``.endPtsOfContours`` attributes;
composite glyphs contain components, available through the ``.components``
attributes.

Because the ``.coordinates`` attribute (and other simple glyph attributes mentioned
above) is only set on simple glyphs and the ``.components`` attribute is only
set on composite glyphs, it is necessary to use the :py:meth:`isComposite`
method to test whether a glyph is simple or composite before attempting to
access its data.

For a composite glyph, the components can also be accessed via array-like access::

        >> assert(font["glyf"]["Aacute"].isComposite())
        >> font["glyf"]["Aacute"][0]
        <fontTools.ttLib.tables._g_l_y_f.GlyphComponent at 0x1027b2ee0>

c                s4    V'       g
   ^ V n         R# Wn        R#     N)rY   r2   )r1   r2   ri   r9   __init__ZGlyph.__init__  s    $%D!	r?   Tc                sh    V P                  W4      pV P                  P                  4        W0n        R # r;   )rF   __dict__Zclearr2   )r1   	glyfTablerD   r2   r{   r9   rd   ZGlyph.compact  s%    ||I4	r?   c                sV   \        V R 4      '       g   R# V P                  '       g   V =^ V n        R# \        P                  ! \
        V P                  V 4      w  r#V =V P                  ^ 8X  d   R# V P                  4       '       d   V P                  W14       R# V P                  V4       R# )r2   N)	rB   r2   rY   r   Zunpack2glyphHeaderFormatr   decompileComponentsdecompileCoordinates)r1   r   Zdummyr2   rr   r9   r=   ZGlyph.expand  s    tV$$yyy	$%D!oo&7DII   A%$$T5%%d+r?   r@   NrA   c               s   \        V R 4      '       d'   V'       d   V P                  V4       MV P                  # V P                  ^ 8X  d   R# V'       d   V P	                  WR7       \
        P                  ! \        V 4      pV P                  4       '       d   WPP                  V4      ,           pV# WPP                  VR7      ,           pV# )r2   r?   r   )rA   )rB   r=   r2   rY   r   r   r   r   r   compileComponentscompileCoordinates)r1   r   rD   r@   rA   r2   s   &&&$$ r9   rF   ZGlyph.compile  s     4  I&yy   A%i?||-t400;;D  11|1LLDr?   c                s   V P                  4       '       d3   V P                   F  pVP                  W4       K  	  \        V R 4      pEM^ p\	        V P
                  4       EFm  pVP                  R4       VP                  4        \	        WPP                  V,          ^,           4       F  pRV P                  V,          ^ ,          3RV P                  V,          ^,          3RV P                  V,          \        ,          3.pV P                  V,          \        ,          '       d   VP                  R4       V P                  V,          \        ,          '       d   VP                  R	4       VP                  RV4       VP                  4        K  	  V P                  V,          ^,           pVP!                  R4       VP                  4        EKp  	  V P
                  ^ 8  pV'       d   V P"                  '       dO   VP                  R4       VP                  4        V P"                  P                  W4       VP!                  R4       MVP                  R4       VP                  4        R# R# )
programcontourr   r   onptinstructionsN)overlapr   )cubicr   )r   r   r]   rB   r*   rY   r[   rU   endPtsOfContoursr   r   r   flagOverlapSimplerG   	flagCubicr\   r^   r   )	r1   r_   r3   compohaveInstructionslastr6   jre   s	   &&&      r9   r]   ZGlyph.toXML  s   F+ )&tY7D4001	* t%:%:1%=%ABAd..q1!45d..q1!45tzz!}{:;E
 zz!}'888^4zz!}y00\2$$T51NN$ C ,,Q/!3i( % 2&  $44q8|||/ ""62n-  0NN r?   c                s   VR 8X  Ed   V P                   ^ 8  d   \        P                  ! R4      hV P                   ^,           V n         \        4       p\	        4       pV F  p\        V\        4      '       g   K  Vw  rpVR8w  d   K)  VP                  \        VR,          4      \        VR,          4      34       \        \        VR,          4      4      pRV9   d/   \        \        VR,          4      4      '       d   V\        ,          pRV9   d/   \        \        VR,          4      4      '       d   V\        ,          pVP                  V4       K  	  \        V R4      '       g'   WPn        W`n        \        V4      ^,
          .V n        R# V P                  P#                  V4       V P                  P#                  V4       V P                   P                  \        V P                  4      ^,
          4       R# VR	8X  d   V P                   ^ 8  d   \        P                  ! R4      hRV n         \        V R
4      '       g   . V n        \'        4       p	V P$                  P                  V	4       V	P)                  WW44       R# VR8X  d_   \*        P,                  ! 4       V n        V F<  p\        V\        4      '       g   K  Vw  rpV P.                  P)                  WW44       K>  	  R# R# )r   z*can't mix composites and contours in glyphr   r   r   r   r   r   r   	componentr   r   Nr   )rY   r   r,   r   	bytearrayra   rb   rG   r   boolr   r   rB   r   r   r+   r   r   r   GlyphComponentrc   r   Programr   )
r1   rP   re   rf   r3   r   r   rh   r   r   
   &&&&&     r9   rc   ZGlyph.fromXML  sF   9$$q(&&'STT$($9$9A$=D!*,KKE"!'511'.$W4<""HU3Z$8(5::N#OPHU4[12%$xi8H/I*J*J--De#XeGn-E(F(FI%DT" # 4//#. "
),[)9A)=(>%  ''4

!!%(%%,,S1A1A-BQ-FG[ $$q(&&'STT$&D!4.."$&(IOO""9-d7;^#$,,.DL"!'511'.$W$$T'B	 # $r?   c                sJ   ^ p^ pTpV P                    F  pWP                  ,          pVP                  ^ 8X  d   K(  VP                  ^ 8  d   VP                  4       w  rM&VP	                  W^,           4      w  rp
\        W*4      pWH,           pW9,           pK  	  \        WCV4      # r   )r   r7   rY   getMaxpValuesgetCompositeMaxpValuesmaxr   )r1   r   maxComponentDepth	nContoursnPointsZinitialMaxComponentDepthr   Z	baseGlyphZnPZnCZcomponentDepth   &&&        r9   r   ZGlyph.getCompositeMaxpValues;  s    	#4 __E!//2I))Q.++a/"002B)2)I)I!;*& %((9$J!lG!I % #77HIIr?   c                sV    \        V P                  4      \        V P                  4      3# r;   )r+   r   r   rw   rx   r9   r   ZGlyph.getMaxpValuesO  s#    4##$c$*?*?&@@@r?   c                s   . V n         ^p^ pV'       dD   \        4       pVP                  W4      w  r6pWF,          pV P                   P                  V4       KK  V'       d   \        P
                  ! RVR,          4      w  pVR,          p\        P                  ! 4       V n        V P                  P                  VRV 4       WR p\        V4      ^8  d"   \        P                  R\        V4      4       R# R# R# )r   r   r   r   NNNzBtoo much glyph data at the end of composite glyph: %d excess bytes)r   r   r:   rG   r   unpackr   r   r   fromBytecoder+   r.   r/   )r1   r2   r   morer   r   Z	haveInstrZnumInstructionss   &&&     r9   r   ZGlyph.decompileComponentsS  s    &(I$-$7$7$H!DT/;OO""9-!'tT"X!>_8D$,,.DLLL%%d+;O&<=()D4yA~XI  r?   c                s$   \         P                   ! R 4      pVP                  VR^V P                  ,           4       \        P                  R8w  d   VP                  4        VP                  4       V n        ^V P                  ,          p\        P                  ! RWV^,            4      w  p\        P                  ! 4       V n        V P                  P                  W^,           V^,           V,            4       V^V,           ,          pV P                  R,          ^,           pV P                  WQV4      w  rgp\        P!                  V4      ;V n        p	^ p
^ p\%        V4       F  pWl,          pV\&        ,          '       d0   V\(        ,          '       d
   Wz,          pM	Wz,          ) pV
^,           p
M'V\(        ,          '       d   ^ pMWz,          pV
^,           p
V\*        ,          '       d0   V\,        ,          '       d
   W,          pM	W,          ) pV^,           pM'V\,        ,          '       d   ^ pMW,          pV^,           pW3W&   K  	  V	P/                  4        \%        \1        V4      4       F  pWl;;,          \2        ,          uu&   K  	  W`n        R# )HNbigr   r   )array	frombytesrY   sys	byteorderbyteswapZtolistr   r   r   r   r   r   r  decompileCoordinatesRawr   zerosr   r*   r   r   r   r   relativeToAbsoluter+   	keepFlagsr   )r1   r2   r   r5   ZinstructionLengthnCoordinatesr   xCoordinatesyCoordinatesr   ZxIndexZyIndexr6   r   r   r   rL   r9   r   ZGlyph.decompileCoordinatesh  s    ;;s+""4(C!d.C.C*C#DE==E!%%' 0 7 7 9$'''%}}T4cAg3FG	 ((*!!$Qwq;L1L"MNq$$$,,R014,0,H,H-
)\
 *:)?)?)MM;|$A8Dj  )##$,A%--A!	!! (!j  )##$,A%--A!	!! (!VKN5 %: 	&&(s5z"AH	!H #
r?   c                sz   \        V4      pR pR p^ p W#,          pV^,          p^p	V\        ,          '       d   W#,          ^,           p	V^,          p\        V	4       F  p
V\        ,          '       d   VR,           pMV\        ,          '       g
   VR,           pV\
        ,          '       d   VR,           pMV\        ,          '       g
   VR,           pWV&   V^,           pK  	  Wq8  g   K   \        P                  ! T4      p\        P                  ! T4      p\        T4      T,
          Y,           ,
          ^8  d4   \        P                  R\        T4      T,
          Y,           ,
          4       \        P                  ! YRY3T,            4      p\        P                  ! YbY;,           Y;,           T,            4      pYMT3# )Z>BZhz$too much glyph data: %d excess bytes)r   
flagRepeatr*   r   r   r   r   r   Zcalcsizer+   r.   r/   r   )r1   r  r2   r5   r   ZxFormatZyFormatr   r   repeatkZxDataLenZyDataLenr  r  s   &&&&           r9   r
  ZGlyph.decompileCoordinatesRaw  sl   ,' 9D1HCFj  Qq6]*$$%mG**%mG*$$%mG**%mGaE #   ??7+??7+t9s?h12a7KK6D	C8#67 }}W3x.HI}}#.3>H+DE
 L00r?   c                s~   R p\        V P                  4      ^,
          p^p^ p\        V P                  4       F1  w  rgWc8X  d   \        V R4      p^ pW'P	                  WEV4      ,           pK3  	  V'       dI   V P
                  P                  4       pV\        P                  ! R\        V4      4      ,           V,           pV# )r?   r   r   )	r+   r   rH   rB   rF   r   getBytecoder   r   )	r1   r   r2   Zlastcomponentr  r   r6   r   r   	   &&       r9   r   ZGlyph.compileComponents  s    DOO,q0!$//2HA!#*4#; --	JJD	 3
 <<335L&++dC,=>>MDr?   c               s   . p\         P                   ! R V P                  4      p\        P                  R8w  d   VP	                  4        VP                  VP                  4       4       V P                  P                  4       pVP                  \        P                  ! R\        V4      4      4       VP                  V4       V P                  P                  4       pVP                  4        VP                  4        V'       d   V P!                  V P"                  V4      pMV P%                  V P"                  V4      pVP'                  V4       RP)                  V4      # )r  r  r   r?   )r  r   r  r  r	  rG   Ztobytesr   r  r   r   r+   r   r   r   absoluteToRelativecompileDeltasGreedyr   compileDeltasForSpeedr   rI   )r1   rA   r2   r   r   deltass   &$    r9   r   ZGlyph.compileCoordinates  s     ;;sD,A,AB==E!%%'$,,./||//1FKKc,&789L!!!&&(!!#--djj&AF //

FCFFxx~r?   c                sB   \        4       p\        4       p\        4       pR p^ p\        W4       EFj  w  pw  rV	^ 8X  d   V\        ,          pMoRT	u;8:  d   ^8:  d;   M M7V\        ,          pV	^ 8  d   V\        ,          pMV	) p	VP	                  V	4       M&VP                  \        P                  ! RV	4      4       V
^ 8X  d   V\        ,          pMoRT
u;8:  d   ^8:  d;   M M7V\        ,          pV
^ 8  d   V\        ,          pMV
) p
VP	                  V
4       M&VP                  \        P                  ! RV
4      4       W8X  d?   V^8w  d8   V^,           pV^8X  d   VP	                  V4       M(V\        ,          VR&   WsR&   M^ pVP	                  V4       TpEKm  	  W4V3# )Nr   r   r   r   )r   r   r   r   rG   r   r   r   r   r   r  )r1   r   r  compressedFlagscompressedXscompressedYslastflagr  r   r   r   r   r9   r  ZGlyph.compileDeltasGreedy  sp    $+ { {.LD&1 Avi'!c!j(q5)+DA##A&##FKKa$89Avi'!c!j(q5)+DA##A&##FKKa$89FcM!Q;#**40*.*;OB'*0B'&&t,HK /L  |<<r?   c           	     sZ   . pR p^ p^ p\        W4       F  w  pw  r\        WV4      w  rzV^V
,           ,          pWTWz3V^,           WG\        ,          V
3.pV F  w  rrW,           V^,           8:  g   K  V\        ,          '       g   K1  VR8  g   K:  \        W4      '       g   KM  V^,          V\        ,          8X  d   W^,           8X  d   Ku  VP	                  W,           WR,           V
34       K  	  Tp\        VR R7      pV^ ,          pK  	  . pV'       d   Vw  rrzVP	                  V4       K   VP                  4        \        4       p\        4       p\        4       p\        V4      p. pV F  pV^,	          V^,          ppVP	                  V4       V\        ,          '       d   VP	                  V4       \        ^V,           4       F/  p\        V4      w  r\        WxV	VV4       VP	                  V4       K1  	  K  	   \        V4       \        R4      h  \         d     Mi ; iTTT3# )Ni   r   c                 s    V ^ ,          # r    )trx   r9   <lambda>Z,Glyph.compileDeltasOptimal.<locals>.<lambda>B  s    adr?   )Zkeyzinternal error)r   r   r  r   rG   minZreverser   Ziterr*   Znextr   Z	ExceptionZStopIteration)r1   r   r  Z
candidatesZ	bestTupleZbestCostr  r   r   r   r   ZnewCandidatesZlastCostZ	lastTupleZlastFlagr   r  r  r  r   ZffZrepeatCountr6   s   &&&                    r9   compileDeltasOptimalZGlyph.compileDeltasOptimal$  s    
	.LD&1'd3DJ&Hd7Ay*+<zJM >H9X)X\9!J..!F*$X44 4z)"l2 !((!.	c>:V >H 'JJN;I |H1 /4 09-DTLL#+ { {fD $	4$;K""4(j  &&{3 1{?+F| !\<H		$ , 	L,-- 		  |<<s   H H%$H%c                s   \        4       p\        4       p\        4       pV Uu. uF  qf^ ,          NK  	  ppV Uu. uF  qf^,          NK  	  pp\        V4      \        V4      \        V4      \        V4      3w  rrV	^ 8H  ;'       d    V^ 8H  pV
^ 8H  ;'       d    V^ 8H  pRT	u;8*  ;'       d    Tu;8*  ;'       d    ^8*  Mu pRT
u;8*  ;'       d    Tu;8*  ;'       d    ^8*  Mu pRp^ p\        W4       EF[  w  pw  ppV'       d   V\        ,          pMeV'       d8   V\
        ,          pV^ 8  d   V\        ,          pMV) pVP                  V4       M&VP                  \        P                  ! RV4      4       V'       d   V\        ,          pMeV'       d8   V\        ,          pV^ 8  d   V\        ,          pMV) pVP                  V4       M&VP                  \        P                  ! RV4      4       VV8X  d@   V^8w  d9   V^,           pV^8X  d   VP                  V4       M)V\        ,          VR&   VVR&   M^ pVP                  V4       TpEK^  	  W4V3# u upi u upi )r   Nr   r   r   r   )r   r"  r   r   r   r   rG   r   r   r   r   r   r  )r1   r   r  r  r  r  rm   xsysZminXZminYZmaxXZmaxYZxZeroZyZeroZxShortZyShortr  r  r   r   r   s   &&&                   r9   r  ZGlyph.compileDeltasForSpeedd  s   #+ { { ##FqddF#"#FqddF#!$R#b'3r7CG!CD	''dai	''dai,,,,,,,,,,.LD&1a i'j(q5)+DA##A&##FKKa$89i'j(q5)+DA##A&##FKKa$89xFcM!Q;#**40*.*;OB'*0OB'&&t,HK /L  |<<a $#s
   IIc               s   V P                  4       '       d   V P                  WR7      '       d   R#  V P                  V\        R7      w  r4pVP	                  4       w  V n        V n        V n        V n        R#   \         d     R# i ; i)a  Recalculates the bounds of the glyph.

Each glyph object stores its bounding box in the
``xMin``/``yMin``/``xMax``/``yMax`` attributes. These bounds must be
recomputed when the ``coordinates`` change. The ``table__g_l_y_f`` bounds
must be provided to resolve component bounds.
r   Nr   )
r   tryRecalcBoundsCompositer   r   calcIntBoundsrQ   rR   rS   rT   ZNotImplementedError)r1   r   r@   r   r   r   s   &&$   r9   r   ZGlyph.recalcBounds  s     $"?"? #@ #
 #
 	$($7$7	$7$Q!FE9?9M9M9O6DIty$)TY" 		s   AA7 7BBc               s   V P                    F  pVP                  4       '       d   K   R# 	  RpV P                    F  pVP                  pW,          pVe   WR9  d(   VP                  WR7       Ve   VP	                  V4       VP
                  VP                  8X  d   VP                  VP                  8X  d   K  VP                  VP                  r\        WFP                  V,           VP
                  V,           34      p\        WFP                  V,           VP                  V,           34      pK  	  Vf   RpVw  V n        V n        V n        V n        R# )a  Try recalculating the bounds of a composite glyph that has
certain constrained properties. Namely, none of the components
have a transform other than an integer translate, and none
uses the anchor points.

Each glyph object stores its bounding box in the
``xMin``/``yMin``/``xMax``/``yMax`` attributes. These bounds must be
recomputed when the ``coordinates`` change. The ``table__g_l_y_f`` bounds
must be provided to resolve component bounds.

Return True if bounds were calculated, False otherwise.
FNr   Tr   r   r   r   )r   _hasOnlyIntegerTranslater7   r   rZ   rR   rT   rQ   rS   r   r   r   )	r1   r   r@   r   Zboundsr7   gr   r   s	   &&$      r9   r&  ZGlyph.tryRecalcBoundsComposite  s	    __E1133 %
 __EI$A!Y%@y@)NN9-vvAFFaff$477EGGq!&66A:qvvz*BCF!&66A:qvvz*BCF %  >!F5;2	49dir?   c                s    \        V R4      '       dG   V P                  '       d3   \        P                  ! RV P                  R,          4      ^ ,          R8H  # R# V P                  R8H  # )z#Test whether a glyph has componentsr2   r   r   Fr   )rB   r2   r   r   rY   rw   rx   r9   r   ZGlyph.isComposite  sQ    4  BF)))6==tyy}5a8B>VQVV((B..r?   r   c               s  a V P                   ^ 8  d$   V P                  V P                  V P                  3# V P	                  4       '       EdE   \        4       p\        4       p. pV P                   EF  pWP                  ,          p VP                  WR7      w  rp
\        T4      pT\        Jd$   TP                   ^ 8  d   TP                  TR7       \        TR4      '       dx   \        TR4      '       d   TP!                  TP                   4       Y6P"                  ,          w  rYP$                  ,          w  rY,
          Y,
          3pTP'                  T4       MTP(                  TP*                  3p\        TR4      '       g   TP'                  T4       MTP                  \,        ,          pTP                  \.        ,          pT'       g   T'       g   \0        pMTpT'       d.   TP'                  T4       TP!                  TP                   4       M,TP!                  TP                   4       TP'                  T4       \3        T4      oTP5                  T3R lT	 4       4       TP5                  T4       TP5                  T
4       EK  	  W5V3# \        4       . \        4       3#   \         d)    \        P                  ! RTP                  ,          4      hi ; i)a  Return the coordinates, end points and flags

This method returns three values: A :py:class:`GlyphCoordinates` object,
a list of the indexes of the final points of each contour (allowing you
to split up the coordinates list into contours) and a list of flags.

On simple glyphs, this method returns information from the glyph's own
contours; on composite glyphs, it "flattens" all components recursively
to return a list of coordinates representing all the components involved
in the glyph.

To interpret the flags for each point, see the "Simple Glyph Flags"
section of the `glyf table specification <https://docs.microsoft.com/en-us/typography/opentype/spec/glyf#simple-glyph-description>`.
r   z3glyph '%s' contains a recursive component referencefirstPtr   c              3   s4   <"   T F  qS,           x  K  	  R # 5ir;   r  ).0Zeoffset   & r9   	<genexpr>Z'Glyph.getCoordinates.<locals>.<genexpr>*  s      <VVV   )rY   r   r   r   r   r   r   r   r7   r   ZRecursionErrorr   r,   r   r   rB   r   r+  secondPt	translater   r   SCALED_COMPONENT_OFFSETUNSCALED_COMPONENT_OFFSETSCALE_COMPONENT_OFFSET_DEFAULTr+   r   )r1   r   r   Z	allCoordsZallFlagsZ	allEndPtsr   r*  r   r   r   Zx1Zy1Zx2Zy2ZmoveZ	apple_wayZms_wayZscale_component_offsetr-  s   &&$                @r9   r   ZGlyph.getCoordinates  s]       1$##T%:%:DJJFF(*I {HIoo.121A1A! 2B 2.K /{; 'A,>,>,B%%E%25),, uk22#--eoo>&}}5FB(8FB7BG+D))$/ !77EGG+D"5+66#--d3$)KK2I$I	!&/H!H )V > 3 6?21'11$7'11%//B (11%//B'11$7Y   <V <<  -&o )p 11#%r9;66i & **M//* s   J&&3Kc                sF   \        V R4      '       g>   V P                  4       '       d&   V P                   Uu. uF  q"P                  NK  	  up# . # V P                  '       d5   \
        P                  ! RV P                  R,          4      ^ ,          ^ 8  d   . # V P                  p^
p. p^pV'       d   \
        P                  ! RW4V^,            4      w  rxV^,          p\        V4      pVP                  VP                  \        V4      4      4       V\        ,          '       d   V^,          pM	V^,          pV\        ,          '       d   V^,          pM9V\        ,          '       d   V^,          pMV\        ,          '       d
   V^,          pV\        ,          pK  V# u upi )zReturns a list of names of component glyphs used in this glyph

This method can be used on simple glyphs (in which case it returns an
empty list) or composite glyphs.
r2   r   r   >HH)rB   r   r   r7   r2   r   r   r%   rG   rl   ARG_1_AND_2_ARE_WORDSWE_HAVE_A_SCALEWE_HAVE_AN_X_AND_Y_SCALEWE_HAVE_A_TWO_BY_TWOMORE_COMPONENTS)	r1   r   r   r2   r6   r   r  r   rk   r  r9   getComponentNamesZGlyph.getComponentNames1  sD    tV$$!!-1__=__==	 yyyFMM$		">qAQFIyy
#]]5$1q5/BNEFAJEi44S\BC,,,QQ&&Q111Q---Q?*D? >s   Fc                s   \        V R4      '       gl   V'       db   V P                  4       '       d   \        V R4      '       d   V =R# \        P                  ! 4       V n        V P                  P                  . 4       R# V P                  '       g   R# \        P                  ! RV P                  R,          4      ^ ,          p\        V P                  4      p^
pV^ 8  Ed   V^V,          ,          pW4^,
          ,          ^,          W4^,
          ,          ,          ^,           pW4,          ^,          W4^,           ,          ,          pV'       d9   ^ ;W4&   W4^,           &   V^,          pV'       d   VRV W4V,           R ,           p^ pMV^V,           ,          p^ p^ p W4,          p	V^,           p^p
V	\        ,          '       d   W4,          ^,           p
V^,           p^ ;rV	\        ,          '       d   ^pMV	\        ,          '       g   ^pV	\        ,          '       d   ^pMV	\        ,          '       g   ^pW{V,           V
,          ,          pW,          pW8  g   K   YG,          pTRT pEMvV P                  4       '       Ed`   ^pRpV'       Ed   W4,          ^,          W4^,           ,          ,          pV'       d   V\        ( ,          pV\        ,          '       d   RpV^,	          W4^ ,           &   V^,          W4^,           &   V^,          p\!        V4      pV\"        ,          '       d   V^,          pM	V^,          pV\$        ,          '       d   V^,          pM9V\&        ,          '       d   V^,          pMV\(        ,          '       d
   V^,          pV\*        ,          pEK  V'       d4   W4,          ^,          W4^,           ,          ,          pV^V,           ,          pVRV pW0n        R# )zRemove padding and, if requested, hinting, from a glyph.
This works on both expanded and compacted glyphs, without
expanding it.r2   r   Nr   r   TF)rB   r   r   r   r   r  r2   r   r   r   r  r   r   r   r   WE_HAVE_INSTRUCTIONSr%   r7  r8  r9  r:  r;  )r1   remove_hintingZnumContoursr2   r6   r  ZinstructionLenr   r   r   r  r   r   r  Zwe_have_instructionsr   rL   r9   trimZ
Glyph.trimZ  s    tV$$##%%tY// L
  $-#4#4#6DLLL--b1yyymmD$))B-8;#![ A!a%[A-!e<AL"gldq5k9N())$1u+Q!8d~+=+?&@@D!"Q''JAwE*$$!Wq[FAA"##*$$F**F*$$F**F&88
$OA8DD#( $A!e4!222E///+/(#qjU#dlUQE
000FAFA?**FA555FA111FA.#"&'Q,$1u+!=Q''8D	r?   c                s*    V P                  RR7       R# )z5Removes TrueType hinting instructions from the glyph.T)r>  N)r?  rw   rx   r9   rt   ZGlyph.removeHinting  s    			&r?   c                sp   V P                  4       '       d9   V P                   F&  pVP                  4       w  rVVP                  WV4       K(  	  R# V P	                  V4       V P                  V4      w  rxp	V'       d$   VP                  4       pVP                  V^ 34       ^ p
R pV EF|  pV^,           pWzV pWV  Uu. uF  p\        V,          NK  	  ppWV  Uu. uF  p\        V,          NK  	  ppTp
^V9  EdX   \        V4      pV'       Ed!   \        V4      pVR,          pV^ ,          pV! V^ ,          V^ ,          ,           R,          4      V! V^,          V^,          ,           R,          4      3pVP                  V4       \        ^ V^4       F  pVV,          pVV^,           ,          pTV^,           V8  d
   V^,           M^ ,          pV! V^ ,          V^ ,          ,           R,          4      V! V^,          V^,          ,           R,          4      3pVP                  VVV4       K  	  EMVP                  R4       VP                   ! V!   EMVP#                  ^4      ^,           pVVR VRV ,           pVVR VRV ,           pVVR VRV ,           pVP                  VR,          4       V'       EdY   VP#                  ^4      ^,           pV^8X  d*   \        V4      ^8  d   VP%                  V^ ,          4       MVRV^,
            Uu. uF  qNK  	  pp\'        V4      pV'       d   Tp\        ^ V^,
          ^4       F  pVV,          pVV^,           ,          pVV^,           ,          pV! V^ ,          V^ ,          ,           R,          4      V! V^,          V^,          ,           R,          4      3pTpVP                  VVV4       K  	  VP                  ! VV^,
          V !   MVP                   ! VRV !   VVR pVVR pVVR pEKa  VP)                  4        EK  	  R# u upi u upi u upi )a8  Draws the glyph using the supplied pen object.

Arguments:
        pen: An object conforming to the pen protocol.
        glyfTable: A :py:class:`table__g_l_y_f` object, to resolve components.
        offset (int): A horizontal offset. If provided, all coordinates are
                translated by this offset.
Nc                 s<    V \        V 4      8X  d   \        V 4      # T # r;   )r%   )vrx   r9   r!  ZGlyph.draw.<locals>.<lambda>  s    qCF{SV99r?         ?r   )r   r   getComponentInfoaddComponentr=   r   r   r2  r   r   Zallr+   ZmoveTor*   ZcurveTorG   ZqCurveToZindexZlineToZanyZ	closePath)r1   penr   r-  r   r7   r   r   r   r   startZmaybeIntendr   ZfcFlagsZcuFlagsr   countZlp0r6   p1p2Zp4Zp3ZfirstOnCurveZnextOnCurveZ
cubicFlagsZlastOnCurves   &&&&                          r9   drawZ
Glyph.draw  s    !__	'0'A'A'C$	  6 - I%)%8%8%C"U%**,K!!61+.9C'C!,G/43/?@/?!kAoo/?F@.3#.>?.>y1}}.>G?EG5LEA
A"AaD1Q4K3#671Q4!A$;RUBU9VWBJJrN"1eQ/$QZ$QU^$a!eemQUC$bebems%:;$bebems%:; BB/ 0 NN4(LL'*
  &||A2!,-07=L3II.1FF!,-07=L3II

72;'g"(,,q/A"5K"a' w<!+JJwqz2189J;?1K%L1KAa1K
%L #J 
 %0E &+1eai%;%,QZ%,QU^%,QU^$,bebems-B$C$,bebems-B$C&" /1 #BB 7 &<  KKU)CDLL',;*?@%kl3G#KL1F%kl3GMMO_  A?X &Ms   =P)P.
P3c                s   V P                  4       '       d9   V P                   F&  pVP                  4       w  rVVP                  WV4       K(  	  R# V P	                  V4      w  rxp	V'       d$   VP                  4       pVP                  V^ 34       ^ p
V F  pV^,           pWzV pWV pTp
VP                  4        VR,          \        ,          '       d   RpMVR,          \        ,          '       d   RpMRp\        V4       Fd  w  ppW,          \        ,          '       d   VP                  VVR7       RpK6  VP                  V4       W,          \        ,          '       d   RMRpKf  	  VP                  4        K  	  R# )zpDraw the glyph using the supplied pointPen. As opposed to Glyph.draw(),
this will not change the point indices.
NZlineZcurveZqcurve)segmentTyper   )r   r   rB  rC  r   r   r2  Z	beginPathr   r   rH   ZaddPointZendPath)r1   rD  r   r-  r   r7   r   r   r   r   rE  rF  r   rG  rM  r6   r   s   &&&&             r9   
drawPointsZGlyph.drawPoints#  sE   
 !__	'0'A'A'C$	  6 - %)%8%8%C"U%**,K!!61+.C'C!,G%FEMMO bzK''$i''%&"7+29{**LLL="(KLL$-3Y-B-B'K , KKM+ r?   c                r    \        V 4      \        V4      8w  d   \        # V P                  VP                  8H  # r;   typeNotImplementedr   r1   otherri   r9   __eq__ZGlyph.__eq__J  +    :e$!!}}..r?   c                J    V P                  V4      pV\        J d   V# V'       * # r;   rU  rR  r1   rT  Zresultr>   r9   __ne__ZGlyph.__ne__O  $    U#>1vA6zAr?   )r   r   r2   r   r   rY   r   rS   rQ   rT   rR   )r?   )T)r   r   r   )#r   r   r   r   r   r   rd   r=   rF   r]   rc   r   r   r   r   r
  r   r   r  r#  r  r   r&  r   r   r   r<  r?  rt   rL  rN  rU  rZ  r   r   r   r   r9   r-   r-     s     ,
,*:>MQ,#J+CZJ(A*6p*1X 2.=`>=@7=rD $& &P/Q7 Q7f'R[z'fP%N/
B Br?   r-   r   c                sH    V ^8  d   QhR\         R\         R\         R\        /# )r   rI  rJ  rK  return)rb   r   Zformat   "r9   __annotate__r_  Y  s.     Y Ye Y YE Yd Yr?   c                 s    \        V 4      p \        V4      p\        V4      pW,           R ,          P                  V4      ;'       g/    \        V 4      \        V4      ,           \        V4      ^,          8H  # )rA  )r   Zisclose_roundv)rI  rJ  rK  r~   r9   _is_mid_pointra  Y  sX    	B	B	BWO$$R(XXGBK'"+,EQSWX,XXr?   c                sF    V ^8  d   QhR\         R\        \        ,          /# )r   interpolatable_glyphsr\  )r-   r   r%   r]  r^  r9   r_  r_  a  s"     h/ h/U h/s3x h/r?   c                 s  aaa \        RRRR7      pRo. p\        V 4       EF  w  r4VP                  ^8  d   K  VP                   FH  p\	        W4      p\	        WE4      pVf   \        WV4       K+  Wg8w  g   K3  \        RV RV RV RV 24      h	  \        4       p^ p	VP                  oVP                  oVP                  p
V
 F  p\        W^,           4       F  pSV,          \        ,          '       g   K  W98  d
   V^,
          MTpW;8  d
   V^,           MT	pSV,          \        ,          '       g   SV,          SV,          8w  d   Kr  \        SV,          SV,          SV,          4      '       g   K  VP                  V4       K  	  V^,           p	K  	  Sf   VoMSP                  V4       VP!                  V4       EK  	  S'       Ed,   VP                  o\"        P"                  ! RVV3R l\        \%        S4      4       4       4      pVP                  p. p^ p^ p\'        S4       FB  pVW,          8  d*   VP!                  W,          V,
          4       V^,          pK6  V^,          pKD  	  V\%        V4      8  d*   VP!                  W,          V,
          4       V^,          pK9  V FI  pVP                  o\)        VV3R	 l\        \%        S4      4       4       4      Vn        Wn	        VVn
        KK  	  Se   S# \        4       # )
a  Drop impliable on-curve points from the (simple) glyph or glyphs.

In TrueType glyf outlines, on-curve points can be implied when they are located at
the midpoint of the line connecting two consecutive off-curve points.

If more than one glyphs are passed, these are assumed to be interpolatable masters
of the same glyph impliable, and thus only the on-curve points that are impliable
for all of them will actually be implied.
Composite glyphs or empty glyphs are skipped, only simple glyphs with 1 or more
contours are considered.
The input glyph(s) is/are modified in-place.

Args:
    interpolatable_glyphs: The glyph or glyphs to modify in-place.

Returns:
    The set of point indices that were dropped if any.

Raises:
    ValueError if simple glyphs are not in fact interpolatable because they have
    different point flags or number of contours.

Reference:
https://developer.apple.com/fonts/TrueType-Reference-Manual/RM01/Chap1.html
N)rY   r   r   zIncompatible z for glyph at master index z: expected z, found r  c              3   sF   <"   T F  qS9  g   K  SV,          x  K  	  R # 5ir;   r  )r,  r6   dropr      & r9   r/  +dropImpliedOnCurvePoints.<locals>.<genexpr>  s     G$5q$(%(($5   !!c              3   sF   <"   T F  qS9  g   K  SV,          x  K  	  R # 5ir;   r  )r,  r6   r   rc  rd  r9   r/  re    s!      1#5a$	q		#5rf  )r   rH   rY   r   rp   r`   rq   rE   r   r   r   r*   r   ra  rZ   Zintersection_updaterG   r  r+   Zsortedr   )rb  ZstaticAttributesZsimple_glyphsr6   r8   rg   ZexpectedZfoundZmay_droprE  r   r   ZprvZnxtZnewFlagsr   Z	newEndPtsZdeltarm   r   rc  r   s   *                  @@@r9   dropImpliedOnCurvePointsrg  a  s   4 'TD DM34!!A%$--D/6HE(E(6" #D6)DQC H  (z%:  . 5"" &&+<<$D5(+a;.. ya!ed xa!eU#J,,suSz1I$VC[&)VC[IIQ , 1HE % <D$$X.U#S 5V t &&;;GE#e*$5G
 "22	Afi-  U!23QQJE	 
 #f+oVY./FA"E&&F 0 1#(V#51 !E #K%.E" # #4..r?   c                   sZ   a  ] tR tRt o 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# )r   i  a+  Represents a component within a composite glyph.

The component is represented internally with four attributes: ``glyphName``,
``x``, ``y`` and ``transform``. If there is no "two-by-two" matrix (i.e
no scaling, reflection, or rotation; only translation), the ``transform``
attribute is not present.
c                s    R # r;   r  rw   rx   r9   r   ZGlyphComponent.__init__  s    r?   c                s    \        V R4      '       d/   V P                  w  w  rw  r4WW4V P                  V P                  3pM^^ ^ ^V P                  V P                  3pV P                  V3# )ap  Return information about the component

This method returns a tuple of two values: the glyph name of the component's
base glyph, and a transformation matrix. As opposed to accessing the attributes
directly, ``getComponentInfo`` always returns a six-element tuple of the
component's transformation matrix, even when the two-by-two ``.transform``
matrix is not present.
r   )rB   r   r   r   r7   )r1   ZxxZxyZyxZyyZtranss   &     r9   rB  ZGlyphComponent.getComponentInfo  sb     4%%#'>> XbxRTVVTVV4E1a0E~~u$$r?   c                s   \         P                  ! R VR,          4      w  r4\        V4      V n        \        V4      pVP	                  \        V4      4      V n        VR,          pV P                  \        ,          '       d   V P                  \        ,          '       d-   \         P                  ! RVR,          4      w  V n        V n	        MA\         P                  ! R VR,          4      w  rV\        V4      \        V4      uV n
        V n        VR,          pMV P                  \        ,          '       d-   \         P                  ! RVR,          4      w  V n        V n	        MA\         P                  ! RVR,          4      w  rV\        V4      \        V4      uV n
        V n        VR,          pV P                  \        ,          '       dL   \         P                  ! RVR,          4      w  p\        V^4      ^ .^ \        V^4      ..V n        VR,          pMV P                  \        ,          '       dL   \         P                  ! RVR,          4      w  r\        V^4      ^ .^ \        V	^4      ..V n        VR,          pM|V P                  \         ,          '       d`   \         P                  ! R	VR
,          4      w  rr\        V^4      \        V
^4      .\        V^4      \        V	^4      ..V n        VR,          pV P                  \"        ,          pV P                  \$        ,          pV P                  \&        \(        ,          \*        ,          \,        ,          \.        ,          \0        ,          ,          V n        WV3# )r6  :N   N:rh  NN>hh>bbr   >BBr   r   >hhhh:N   N:rm  NN)r   r   r%   r   rl   r7   r7  ARGS_ARE_XY_VALUESr   r   r+  r1  r8  fi2flr   r9  r:  r;  r=  ROUND_XY_TO_GRIDUSE_MY_METRICSr3  r4  NON_OVERLAPPINGOVERLAP_COMPOUND)r1   r2   r   r   rk   r   r   scaleZxscaleZyscalescale01scale10r  r   s   &&&           r9   r:   ZGlyphComponent.decompile  s   ud2h7Z
g,"//G=Bx::---zz...!'ud2h!?}}UDH5.1!fc!f+dm8Dzz...!'ud2h!?}}UDH5.1!fc!f+dm8D::''}}T484HUub!1%E%$%DN 8DZZ222#]]5$r(;NFvr"A&E&"%&DN 8DZZ...17wR1Q.Vgvr"E'2$67w#U62%67DN 8DzzO+::(<<ZZ%& (( 	
 

 t++r?   c                sH   R pV P                   \        \        ,          \        ,          \        ,          \
        ,          \        ,          ,          pV'       d   V\        ,          pV'       d   V\        ,          p\        V R4      '       d   ^ V P                  u;8:  d   ^8:  dT   M MP^ V P                  u;8:  d   ^8:  d8   M M4V\        P                  ! RV P                  V P                  4      ,           pMV\        P                  ! RV P                  V P                  4      ,           pV\        ,          pM\        V P                   4      p\        V P"                  4      pV\$        ,          pR	Tu;8:  d   ^8:  d5   M M1R	Tu;8:  d   ^8:  d#   M MV\        P                  ! RWg4      ,           pM+V\        P                  ! RWg4      ,           pV\        ,          p\        V R4      '       Edo   V P&                   UUu. uF  q Uu. uF  p\)        V^4      NK  	  upNK   	  p	ppV	^ ,          ^,          '       g   V	^,          ^ ,          '       dh   V\*        ,          pV\        P                  ! RV	^ ,          ^ ,          V	^ ,          ^,          V	^,          ^ ,          V	^,          ^,          4      ,           pMV	^ ,          ^ ,          V	^,          ^,          8w  dJ   V\,        ,          pV\        P                  ! RV	^ ,          ^ ,          V	^,          ^,          4      ,           pM9V\.        ,          pV\        P                  ! RV	^ ,          ^ ,          4      ,           pVP1                  V P2                  4      p
\        P                  ! RWZ4      V,           # u upi u uppi )
r?   r+  rk  r6  rj  ri  r   rl  r   i)r   rp  rq  r3  r4  rr  rs  r;  r=  rB   r+  r1  r   r   r7  r   r   r   rn  r   fl2fir:  r9  r8  rs   r7   )r1   r  r   r   r2   r   r   r   Zrowr   rk   s   &&&&       r9   rF   ZGlyphComponent.compile(  s    

%& (( 	
 
 O+E00E4##T\\(S(qDMM/HS/Hfkk%t}}MMfkk%t}}MM 55AA..E S tq'7C'7fkk%66fkk%66 554%%@DO41%2,4IO|A)A,q// 44fkkaLOaLOaLOaLO  1aIaLO3 88fkk%1a)A,q/RR/fkk$	!Q@@&&t~~6{{5%1D88% 5Os   N	NNNc           	     s   R V P                   3.p\        V R4      '       g%   VRV P                  3RV P                  3.,           pM#VRV P                  3RV P
                  3.,           p\        V R4      '       Ed6   V P                  pV^ ,          ^,          '       g   V^,          ^ ,          '       dw   VR\        V^ ,          ^ ,          ^4      3R\        V^ ,          ^,          ^4      3R\        V^,          ^ ,          ^4      3R	\        V^,          ^,          ^4      3.,           pMV^ ,          ^ ,          V^,          ^,          8w  dA   VR\        V^ ,          ^ ,          ^4      3R	\        V^,          ^,          ^4      3.,           pM$VR
\        V^ ,          ^ ,          ^4      3.,           pVR\        V P                  4      3.,           pVP                  RV4       VP                  4        R# )r7   r+  r   r   r1  r   scalexru  rv  scaleyrt  r   r   N)r7   rB   r   r   r+  r1  r   fl2strZhexr   r\   rU   )r1   r_   r3   re   r   r   r9   r]   ZGlyphComponent.toXML^  s   t~~./tY''c466]S$&&M::Ei6T]]8STTE4%%I|A)A,q//vil1or:;y|A ;<y|A ;<vil1or:;	!  1aIaLO3vil1or:;vil1or:;! 
 '6)A,q/2+F!G HH'3tzz?344e,r?   c                s   VR ,          V n         RV9   d0   \        VR,          4      V n        \        VR,          4      V n        M.\        VR,          4      V n        \        VR,          4      V n        RV9   dY   \        VR,          ^4      p\        VR,          ^4      p\        VR,          ^4      p\        VR,          ^4      pWV.Wx..V n        MbRV9   d5   \        VR,          ^4      p\        VR,          ^4      pV^ .^ V..V n        M'R	V9   d!   \        VR	,          ^4      p	V	^ .^ V	..V n        \        VR
,          4      V n        R# )r7   r+  r1  r   r   ru  rx  rv  ry  rt  r   N)	r7   r   r+  r1  r   r   str2flr   r   )
r1   rP   re   rf   r3   rx  ru  rv  ry  rt  r   r9   rc   ZGlyphComponent.fromXMLy  s,   {+#E)$45DL$U:%67DMeCj)DFeCj)DFE(OR0FU9-r2GU9-r2GE(OR0F%/'1BCDNE(OR0FE(OR0F%qkAv;7DN5>2.E$aj1e*5DNeGn-
r?   c                rO  r;   rP  rS  ri   r9   rU  ZGlyphComponent.__eq__  rV  r?   c                rW  r;   rX  rY  r>   r9   rZ  ZGlyphComponent.__ne__  r[  r?   c                s   \        V R4      '       * ;'       dh    \        V R4      '       * ;'       dO    \        V P                  4      P                  4       ;'       d$    \        V P                  4      P                  4       # )z{Return True if it's a 'simple' component.

That is, it has no anchor points and no transform other than integer translate.
r+  r   )rB   Zfloatr   
is_integerr   rw   rx   r9   r)  Z'GlyphComponent._hasOnlyIntegerTranslate  sk     i(( + +D+..+ +dff((*+ + dff((*		
r?   )r+  r   r7   r1  r   r   r   N)r   r   r   r   r   r   rB  r:   rF   r]   rc   rU  rZ  r)  r   r   r   r   r9   r   r     s?     %*5,n49l6../
B

 

r?   r   c                   s,  a  ] tR tRt o Rt. 3R lt]R 4       t]R 4       t	R t
R tR tR	 tR
 tR tR tR tR]/R ltR t]3R ltR tR tR tR tR tR tR tR tR tR]/R ltR t R t!R t"R t#] t$]"t%R  t&R! t'R" t(R# t)R$ t*R% t+]+t,R&t-V t.R'# )(r   i  zA list of glyph coordinates.

Unlike an ordinary list, this is a numpy-like matrix object which supports
matrix addition, scalar multiplication and other operations described below.
c                s^    \         P                   ! R 4      V n        V P                  V4       R# )rm   N)r  _ar   )r1   iterableri   r9   r   ZGlyphCoordinates.__init__  s    ++c"Hr?   c                s    V P                   # )z+Returns the underlying array of coordinatesr}  rw   rx   r9   r  ZGlyphCoordinates.array  s     wwr?   c                s    \        4       pVP                  P                  \        V ^,          VP                  P                  ,          4      4       V# )zKCreates a new ``GlyphCoordinates`` object with all coordinates set to (0,0))r   r}  r  ZbytesZitemsize)rH  r*  ru   r9   r  ZGlyphCoordinates.zeros  s7     	uUQY678r?   c                sd    \        4       pVP                  P                  V P                  4       V# )zMCreates a new ``GlyphCoordinates`` object which is a copy of the current one.)r   r}  r   )r1   r   ru   r9   r   ZGlyphCoordinates.copy  s#    	DGGr?   c                s:    \        V P                  4      ^,          # )z/Returns the number of coordinates in the array.r+   r}  rw   rx   r9   r   ZGlyphCoordinates.__len__  s    477|q  r?   c                sv   V P                   p\        V\        4      '       d   \        VP	                  \        V 4      4      !  p. pV F  pV^V,          ,          pV^V,          ^,           ,          pTP                  VP                  4       '       d   \        V4      MTVP                  4       '       d   \        V4      MT34       K  	  V# V^V,          ,          pV^V,          ^,           ,          pVP                  4       '       d   \        V4      MTVP                  4       '       d   \        V4      3# T3# )z!Returns a two element tuple (x,y))	r}  ra   slicer*   rK   r+   rG   r|  r%   )r1   r  arK   Zretr   r   s   &&     r9   r}   ZGlyphCoordinates.__getitem__  s    GGaQYYs4y12GCa!eHa!eaiL

 ||~~SV1c!fTUV  Ja!eHa!eaiL,,..Aa1<<>>QQQqQQr?   c                s   \        V\        4      '       dB   \        VP                  \	        V 4      4      !  p\        V4       F  w  rEW$,          W&   K  	  R# Vw  V P                  ^V,          &   V P                  ^V,          ^,           &   R# )z7Sets a point's coordinates to a two element tuple (x,y)N)ra   r  r*   rK   r+   rH   r}  )r1   r  r@  rK   r   r6   s   &&&   r9   r   ZGlyphCoordinates.__setitem__  sj    aQYYs4y12G!'*$ +-.*AA	*r?   c                s    ^V,          \        V P                  4      ,          pV P                  V V P                  V R# )zRemoves a point from the listNr  )r1   r6   ri   r9   r   ZGlyphCoordinates.__delitem__  s.    Uc$''l"GGAJGGAJr?   c                sN    R RP                  R V  4       4      ,           R,           # )zGlyphCoordinates([Z,c              3   s8   "   T F  p\        V4      x  K  	  R # 5ir;   )Zstr)r,  r   ru   r9   r/  Z,GlyphCoordinates.__repr__.<locals>.<genexpr>  s     .Dt!s1vvts   z]))rI   rw   rx   r9   __repr__ZGlyphCoordinates.__repr__  s!    #chh.Dt.D&DDtKKr?   c                sN    V P                   P                  \        V4      4       R # r;   )r}  r   rb   )r1   r   ri   r9   rG   ZGlyphCoordinates.append  s    uQx r?   c                sN    V F  pV P                   P                  V4       K   	  R # r;   )r}  r   )r1   r~  r   r>   r9   r   ZGlyphCoordinates.extend  s    AGGNN1 r?   r   c               sr    V\         J d   R # V P                  p\        V4       F  w  r4V! V4      W#&   K  	  R # r;   )r   r}  rH   )r1   r   r  r6   values   &$   r9   r   ZGlyphCoordinates.toInt  s1    GGG!!HA<AD %r?   c                s    V P                   pV'       g   R# VR,          pVR,          p\        V4      \        V4      \        V4      \        V4      3# )r   :r   Nr   :r   Nr   r(  )r}  r"  r   )r1   r  r$  r%  rn   r9   
calcBoundsZGlyphCoordinates.calcBounds  sE    GGtWtW2wBR#b'11r?   c                s   a \         ;QJ d%    . V3R  lV P                  4        4       F  NK  	  5# ! V3R  lV P                  4        4       4      # )c              3   s4   <"   T F  pS! V4      x  K  	  R # 5ir;   r  )r,  r@  r   r.  r9   r/  Z1GlyphCoordinates.calcIntBounds.<locals>.<genexpr>  s     9'8!U1XX'8r0  )rb   r  )r1   r   s   &fr9   r'  ZGlyphCoordinates.calcIntBounds  s3    u9t'89u9u9t'8999r?   c                s    V P                   p^ ^ r2\        ^ \        V4      ^4       F7  pW,          V,           ;W&   pW^,           ,          V,           ;W^,           &   pK9  	  R# r   r}  r*   r+   )r1   r  r   r   r6      &    r9   r  Z#GlyphCoordinates.relativeToAbsolute  sU    GG!1q#a&!$AtaxAD1U8a<'A!eHq %r?   c                s    V P                   p^ ^ r2\        ^ \        V4      ^4       F9  pW,          pW^,           ,          pWR,
          W&   Wc,
          W^,           &   TpTpK;  	  R# r   r  )r1   r  r   r   r6   ZnxZnys   &      r9   r  Z#GlyphCoordinates.absoluteToRelative  s[    GG!1q#a&!$ABq5B6ADvA!eHAA %r?   c                s    Vw  r#V^ 8X  d
   V^ 8X  d   R# V P                   p\        ^ \        V4      ^4       F2  pWE;;,          V,          uu&   WE^,           ;;,          V,          uu&   K4  	  R# )z1
>>> GlyphCoordinates([(1,2)]).translate((.5,0))
Nr  r1   r   r   r   r  r6      &&    r9   r2  ZGlyphCoordinates.translate  U     6a1fGGq#a&!$ADAID!eHMH %r?   c                s    Vw  r#V^8X  d
   V^8X  d   R# V P                   p\        ^ \        V4      ^4       F2  pWE;;,          V,          uu&   WE^,           ;;,          V,          uu&   K4  	  R# )z-
>>> GlyphCoordinates([(1,2)]).scale((.5,0))
Nr  r  r  r9   rt  ZGlyphCoordinates.scale#  r  r?   c                sh   V P                   p\        ^ \        V4      ^4       F  pW#,          pW#^,           ,          pWA^ ,          ^ ,          ,          WQ^,          ^ ,          ,          ,           pWA^ ,          ^,          ,          WQ^,          ^,          ,          ,           pWbV&   WrV^,           &   K  	  R# )z;
>>> GlyphCoordinates([(1,2)]).transform(((.5,0),(.2,.5)))
Nr  )r1   r   r  r6   r   r   ZpxZpys   &&      r9   r   ZGlyphCoordinates.transform/  s     GGq#a&!$AAa%AqT!WqQ47{*BqT!WqQ47{*BaDa!eH %r?   c                rO  )z
>>> g = GlyphCoordinates([(1,2)])
>>> g2 = GlyphCoordinates([(1.0,2)])
>>> g3 = GlyphCoordinates([(1.5,2)])
>>> g == g2
True
>>> g == g3
False
>>> g2 == g3
False
)rQ  rR  r}  rS  ri   r9   rU  ZGlyphCoordinates.__eq__<  s-     :e$!!ww%((""r?   c                rW  )z
>>> g = GlyphCoordinates([(1,2)])
>>> g2 = GlyphCoordinates([(1.0,2)])
>>> g3 = GlyphCoordinates([(1.5,2)])
>>> g != g2
False
>>> g != g3
True
>>> g2 != g3
True
rX  rY  r>   r9   rZ  ZGlyphCoordinates.__ne__L  s&     U#>1vA6zAr?   c                s"    V P                  4       # )z
>>> g = GlyphCoordinates([(1,2)])
>>> g
GlyphCoordinates([(1, 2)])
>>> g2 = +g
>>> g2
GlyphCoordinates([(1, 2)])
>>> g2.translate((1,0))
>>> g2
GlyphCoordinates([(2, 2)])
>>> g
GlyphCoordinates([(1, 2)])
)r   rw   rx   r9   __pos__ZGlyphCoordinates.__pos__]  s     yy{r?   c                sp    V P                  4       pVP                  p\        V4       F
  w  r4V) W#&   K  	  V# )z
>>> g = GlyphCoordinates([(1,2)])
>>> g
GlyphCoordinates([(1, 2)])
>>> g2 = -g
>>> g2
GlyphCoordinates([(-1, -2)])
>>> g
GlyphCoordinates([(1, 2)])
)r   r}  rH   )r1   rr  r6   r  r  r9   __neg__ZGlyphCoordinates.__neg__m  s6     IIKDD!!HA6AD %r?   c               sJ    V P                  4       pVP                  VR 7       V# )r   )r   r   )r1   r   r  s   &$ r9   	__round__ZGlyphCoordinates.__round__~  s     IIK	er?   c                @    V P                  4       P                  V4      # r;   )r   __iadd__rS  ri   r9   __add__ZGlyphCoordinates.__add__      yy{##E**r?   c                r  r;   )r   __isub__rS  ri   r9   __sub__ZGlyphCoordinates.__sub__  r  r?   c                r  r;   )r   __imul__rS  ri   r9   __mul__ZGlyphCoordinates.__mul__  r  r?   c                r  r;   )r   __itruediv__rS  ri   r9   __truediv__ZGlyphCoordinates.__truediv__  s    yy{''..r?   c                s    W) ,           # r;   r  rS  ri   r9   __rsub__ZGlyphCoordinates.__rsub__  s    r?   c                s   \        V\        4      '       d   V P                  V4       V # \        V\        4      '       dC   VP                  pV P                  p\        V4       F  w  r4W#;;,          V,          uu&   K  	  V # \        # )z
>>> g = GlyphCoordinates([(1,2)])
>>> g += (.5,0)
>>> g
GlyphCoordinates([(1.5, 2)])
>>> g2 = GlyphCoordinates([(3,4)])
>>> g += g2
>>> g
GlyphCoordinates([(4.5, 6)])
ra   rb   r2  r   r}  rH   rR  r1   rT  r  r6   r     &&   r9   r  ZGlyphCoordinates.__iadd__  si     eU##NN5!Ke-..HHEA%e, -Kr?   c                s4   \        V\        4      '       d&   V P                  V^ ,          ) V^,          ) 34       V # \        V\        4      '       dC   VP                  pV P                  p\        V4       F  w  r4W#;;,          V,          uu&   K  	  V # \        # )z
>>> g = GlyphCoordinates([(1,2)])
>>> g -= (.5,0)
>>> g
GlyphCoordinates([(0.5, 2)])
>>> g2 = GlyphCoordinates([(3,4)])
>>> g -= g2
>>> g
GlyphCoordinates([(-2.5, -2)])
r  r  r  r9   r  ZGlyphCoordinates.__isub__  sz     eU##NNU1XIay12Ke-..HHEA%e, -Kr?   c                s   \        V\        4      '       d   V P                  V4       V # \        V\        4      '       dG   V^8X  d   V # V P                  p\        \        V4      4       F  pW#;;,          V,          uu&   K  	  V # \        # )z
>>> g = GlyphCoordinates([(1,2)])
>>> g *= (2,.5)
>>> g *= 2
>>> g
GlyphCoordinates([(4, 2)])
>>> g = GlyphCoordinates([(1,2)])
>>> g *= 2
>>> g
GlyphCoordinates([(2, 4)])
)ra   rb   rt  r   r}  r*   r+   rR  )r1   rT  r  r6   rr   r9   r  ZGlyphCoordinates.__imul__  sl     eU##JJuKeV$$zA3q6] #Kr?   c                s    \        V\        4      '       d   W3p\        V\        4      '       d;   VR8X  d   V # V P                  RV^ ,          ,          RV^,          ,          34       V # \        # )za
>>> g = GlyphCoordinates([(1,3)])
>>> g /= (.5,1.5)
>>> g /= 2
>>> g
GlyphCoordinates([(1, 1)])
g      ?)r   r   )ra   r   rb   rt  rR  rS  ri   r9   r  ZGlyphCoordinates.__itruediv__  s]     eV$$NEeU##JJeAheAh78Kr?   c                r   )z
>>> g = GlyphCoordinates([])
>>> bool(g)
False
>>> g = GlyphCoordinates([(0,0), (0.,0)])
>>> bool(g)
True
>>> g = GlyphCoordinates([(0,0), (1,0)])
>>> bool(g)
True
>>> g = GlyphCoordinates([(0,.5), (0,0)])
>>> bool(g)
True
)r   r}  rw   rx   r9   __bool__ZGlyphCoordinates.__bool__  s     DGG}r?   r  N)/r   r   r   r   r   r   Zpropertyr  Zstaticmethodr  r   r   r}   r   r   r  rG   r   r   r   r  r'  r  r  r2  rt  r   rU  rZ  r  r  r  r  r  r  r  Z__radd__Z__rmul__r  r  r  r  r  r  Z__nonzero__r   r   r   r   r9   r   r     s      !#     !R$/L! W  2 #* :(	

# B" " 
+++/ HH002$" Kr?   r   Z__main__r   )r   r   r   )kr   Zcollectionsr    ZfontTools.miscr   Z	fontToolsr   r   ZfontTools.misc.transformr   ZfontTools.misc.textToolsr   r   r   ZfontTools.misc.arrayToolsr   r	   ZfontTools.misc.bezierToolsr
   ZfontTools.misc.fixedToolsr   ro  r   rw  r   rz  r   r{  ZfontTools.misc.roundToolsr   r   ZfontTools.misc.vectorr   Znumbersr   Z r   r   r  r   r  ZloggingZmathrV   r   ZfontTools.misc.filenamesr   ZfontTools.misc.loggingToolsr   Zenumr   Z	functoolsr   Ztypesr   Ztypingr   Z	getLoggerr   r.   rI   Zsplitr5  r   r   r   r   r   r   r  r   r   r   r   r  r   r   r   r   r   r   r7  rn  rp  r8  rr  r;  r9  r:  r=  rq  rs  r3  r4  r   Zobjectr-   r  r`  ra  rg  r   r   ZdoctestZexitZtestmodZfailedr  r?   r9   <module>r     s1   < " "   8 9 9 ? :  7 (    
     	 $ 7 9   ! !
 ((7==%b)
* "# l<\.. l<^ @
  


		 	 ++i7	 qqBqB:A4=
    !      "  !H 
vBF vBv &""'
2Yh/VW
V W
t[v [|
 zHHW__%%& r?   