L i̩dZddlmZmZmZmZddlmZmZm Z m Z ddl m Z ddl Z ddlZejeZdZdZdZd Zd Zd Zd Zd ZdZdgdzZdegzedddegzedddegzedddegzeddeed<eedk(sJeddZeed<eed<eddZeed<eed<eed<gdZe eDcic]\}}|| c}}Z!dZ"dZ#gdZ$dZ%e%dZ&e%dZ'e%d Z(e jRfd!Z*eded"zZ+d#Z,Gd$d%e-Z.Gd&d'e/Z0gd(Z1Gd)d*e0Z2Gd+d,e0Z3Gd-d.e3Z4Gd/d0e4Z5Gd1d2e/Z6Gd3d4e6Z7Gd5d6e/Z8d7Z9ycc}}w)8zwpsCharStrings.py -- module implementing various kinds of CharStrings: CFF dictionary data and Type1/Type2 CharStrings. ) fixedToFloat floatToFixedfloatToFixedToStrstrToFixedToFloat)bytechrbyteord bytesjoinstrjoin) BoundsPenNc|dk(r|t||f}|dz}n|} |j|}|j|}||fS#t$rd|fcYSwxYw)N )r operatorsKeyErrorhandle_operator)selfb0dataindexopoperatorvalues b/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/fontTools/misc/psCharStrings.py read_operatorrst Rx'$u+& '  >>"%   *E %< U{sA AAc|dz |fS)Nrrrrs r read_byter"s 8U?cDt||}|dz dz|zdz|dzfS)Nlrrrrrrb1s rread_smallInt1r(&s2 e B H b 3 & 11r cFt||}|dz dz|z dz |dzfS)Nr#r$rr%r&s rread_smallInt2r++s4 e B #X; r !C ' 22r cLtjd|||dz\}||dzfS)N>hstructunpackrrrrrs r read_shortIntr30.}}T4 #:;HU %!) r cLtjd|||dz\}||dzfS)N>lr/r2s r read_longIntr85r4r cbtjd|||dz\}t|d|dzfS)Nr6r7 precisionBits)r0r1rr2s rread_fixed1616r=:s5}}T4 #:;HU R 0%!) ;;r c"tsJt|fSN)NotImplementedErrorNotImplementedrs r read_reservedrB?s   5  r cd} t||}|dz}|dzdz }|dz}|dk(rn|t|z}|dk(rn |t|z}Et||fS)Nrr7)r realNibblesfloat)rrrrnumberbnibble0nibble1s rread_realNumberrMDs F  DK  t8/d( c> +g.. c> +g..  =% r r# r"r7r*)0123456789.EE-N-ci}i}|D]R}t|dk(r |d||d<n |dd||d<t|dtr |d||d<G|df||d<T||fS)Nr.rr)len isinstancetuple) operatorListoperopcitems rbuildOperatorDictrk|s D C& t9> GDaM HDaM d1gu %7CQL G:CQL& 9r )4rhstemvstemr7vmovetorlinetohlinetovlineto rrcurveto callsubr returnendchar)rFvsindex)r:blend)hstemhm)hintmask)cntrmaskrmovetohmoveto)vstemhm) rcurveline) rlinecurve) vvcurveto) hhcurveto)rR callgsubrrS vhcurveto hvcurveto)r rignore))r roand))r r7or))r rtnot))r r}store))r abs))r radd))r rsub)r r div))r load))r rneg))r rFeq))r rdrop))r rput))r rget))r rifelse))r rrandom))r rmul))r rsqrt))r rdup))r rQexch))r rRr))r rSroll))r "hflex))r #flex))r $hflex1))r %flex1c|dk(rtd}td}n'|dk(rd}td}n|dk(sJtd}d}|ttjtj|fd}|S)NcffrQrRt1rPt2cd|cxkrdkrnn ||dz}|Sd|cxkrdkr$nn!|dz }||dz dz||dzz}|Sd |cxkrd kr%nn"| dz }||dz d z||dzz}|S|d |cxkrd krnn||d|z}|S|)tjd|d|d|z}|S||d|z}|S)Nikrr$kr}r"rPiir*iir-zk4-byte T2 number got passed to the IntType handler. This should happen only when reading in old XML files. r6)logwarning)r fourByteOprpackr1 twoByteOpcodes r encodeIntz getIntEncoder..encodeInts% 5 C 53;'D4 3E !T !CKEEQJ#-.1FFD. -e #t #FSLEEQJ#-.1FFD( ' "v'?%'?tD%00D$ #  KK#  3<$tU"33D T5 11D r )rr0rr1)formatrrrs r getIntEncoderrsq BK R[ 4 S\ ~~BK   [[}} #J r rrrc`t|d}|dzdk(rt|dz Sd|d|zS)z For T2 onlyr:r;irr6)r encodeIntT2)frrs r encodeFixedrs; " -E v~5B;''dE***r rFc|dk(rtSd|z}|dddk(r|dd}n|dddk(r d|ddz}n|jd r.|jd }d |t|t|z fz}nm|j d }|j d }|dk7rF|dk7rA|d|}||dz|}t ||dzd}|t|z }|dk(r||d }nd|||fz}|j dr5|jd d\} }d| |jd t|fz}g} |r\|d} |dd}| d k(r2|dd} | dk(r|dd}d} n | dk(r|dd}|j d r|dd}| jt| |r\| jdt| dzr| jdtd} tdt| dD]}| t| |dz| |dzzz} !| S)Ngz%.8Gr.z0.rroz-0.ra000rTz%sE%dr^r_z%s%sE%d)z.0z-.0z%s%sE-%drr`+rFrSr7) realZeroBytesendswithrstriprdfindint startswithsplitlstripappendrealNibblesDictrrange)rssignificantDigitsdotIndexeIndex integerPartfractionalPartexponent newExponentsignnibblescc2dis r encodeFloatr sCCx  A!u} abE 2A% !AB%K E HHSM (#a&37H3I*IJ J66#; r>flIX,Kx!|f5N1VaZ\?+H"S%88Ka*N;nk JJ||M"''#q/a $ s1v6 6G aD abE 82ABSyabEsabE||C abEq)*  NN3 7|as A 1c'lA &:  a'!a%.89 9: Hr c eZdZy)CharStringCompileErrorN)__name__ __module__ __qualname__rr rrr?sr rceZdZd,dZdZdddZdZdZdZd Z d Z d Z d Z d Z dZdZdZdZdZeZdZdZdZdZdZdZdZdZdZdZdZdZdZ d Z!d!Z"d"Z#d#Z$d$Z%d%Z&d&Z'd'Z(d(Z)d)Z*d*Z+d+Z,y)-SimpleT2DecompilerNc||_t||_||_t||_||_||_|jyr?) localSubrs calcSubrBias localBias globalSubrs globalBiasprivateblenderreset)rrrrr s r__init__zSimpleT2Decompiler.__init__Ds@$%j1&&{3   r cXg|_g|_d|_d|_d|_d|_yNr) callingStack operandStack hintCount hintMaskBytes numRegionsvsIndexrs rr zSimpleT2Decompiler.resetMs/ r  pushToStackc|jj||j}|rg}|j}nd}||jj}d} |j |\}}}|nP|||r=d|z} t || d} | | |} | r'| \} }|| n|j n||h|r|j|jd=y)Ncyr?r)xs rz,SimpleT2Decompiler.execute..\sr rop_r)rrneedsDecompilationrgetTokengetattrpopall setProgram) r charStringrrprogram pushToProgramrtoken isOperator handlerNamehandlerrvrs rexecutezSimpleT2Decompiler.executeUs   ,'::< G#NNM*M  ++22K'1':':5'A $E:u} % #em !$ T:& B/1, u%m4KKME"!"   ! !' *   b !r c>|jd}|jd=|SNrrrrs rpopzSimpleT2Decompiler.popus%!!"%   b ! r cB|jdd}g|jdd|Sr?r,rstacks rrzSimpleT2Decompiler.popallzs'!!!$!! r c:|jj|yr?)rrr-s rpushzSimpleT2Decompiler.pushs   'r c|jryyr?r,rrs r op_returnzSimpleT2Decompiler.op_returns     r cyr?rr5s r op_endcharzSimpleT2Decompiler.op_endchar r cyr?rr5s r op_ignorezSimpleT2Decompiler.op_ignorer9r c~|j}|j||jz}|j|yr?)r.rrr)rr subrIndexsubrs r op_callsubrzSimpleT2Decompiler.op_callsubrs0HHJ y4>>9: Tr c~|j}|j||jz}|j|yr?)r.rrr)r=s r op_callgsubrzSimpleT2Decompiler.op_callgsubrs2HHJ  DOO ;< Tr c$|jyr? countHintsr5s rop_hstemzSimpleT2Decompiler.op_hstem  r c$|jyr?rDr5s rop_vstemzSimpleT2Decompiler.op_vstemrGr c$|jyr?rDr5s r op_hstemhmzSimpleT2Decompiler.op_hstemhmrGr c$|jyr?rDr5s r op_vstemhmzSimpleT2Decompiler.op_vstemhmrGr c|js'|j|jdzdz|_|jdj ||j\}}||fS)Nrzr}r)rrErrgetBytes)rrrs r op_hintmaskzSimpleT2Decompiler.op_hintmasks^!! OO "&..1"4!:D #004==eTEWEWX ue##r cd|j}|jt|dzz|_yNr.)rrrdrargss rrEzSimpleT2Decompiler.countHintss%{{}#d)q.8r ctr?r@r5s rop_andzSimpleT2Decompiler.op_and!!r ctr?rVr5s rop_orzSimpleT2Decompiler.op_orrXr ctr?rVr5s rop_notzSimpleT2Decompiler.op_notrXr ctr?rVr5s rop_storezSimpleT2Decompiler.op_storerXr ctr?rVr5s rop_abszSimpleT2Decompiler.op_absrXr ctr?rVr5s rop_addzSimpleT2Decompiler.op_addrXr ctr?rVr5s rop_subzSimpleT2Decompiler.op_subrXr ctr?rVr5s rop_divzSimpleT2Decompiler.op_divrXr ctr?rVr5s rop_loadzSimpleT2Decompiler.op_loadrXr ctr?rVr5s rop_negzSimpleT2Decompiler.op_negrXr ctr?rVr5s rop_eqzSimpleT2Decompiler.op_eqrXr ctr?rVr5s rop_dropzSimpleT2Decompiler.op_droprXr ctr?rVr5s rop_putzSimpleT2Decompiler.op_putrXr ctr?rVr5s rop_getzSimpleT2Decompiler.op_getrXr ctr?rVr5s r op_ifelsezSimpleT2Decompiler.op_ifelserXr ctr?rVr5s r op_randomzSimpleT2Decompiler.op_randomrXr ctr?rVr5s rop_mulzSimpleT2Decompiler.op_mulrXr ctr?rVr5s rop_sqrtzSimpleT2Decompiler.op_sqrtrXr ctr?rVr5s rop_dupzSimpleT2Decompiler.op_duprXr ctr?rVr5s rop_exchzSimpleT2Decompiler.op_exchrXr ctr?rVr5s rop_indexzSimpleT2Decompiler.op_indexrXr ctr?rVr5s rop_rollzSimpleT2Decompiler.op_rollrXr c|jdk(r|jj|_|j}||jdzz}|j|j ||z d=yt |j |z }||zx}}||kr^||jz}|j ||}|j |j|} |j |xx| z cc<|}|dz }||kr^g|j |dyNrr)rr getNumRegionsr.r rrdr) rr numBlendsnumOpsargiend_argstupleinext_tideltasdeltas rop_blendzSimpleT2Decompiler.op_blends ??a "ll88:DOHHJ doo12 << !!9$%'t(()F2D $y 0 0Hv/ 4??2**6': T\\6:!!$'50'   /,.D  hi (r cr|j}||_|jj||_yr?)r.rrrr)rrvis r op_vsindexzSimpleT2Decompiler.op_vsindexs* XXZ ,,44R8r NN)-rrrr r r)r.rr3r6r8r;r@rBrFrIrKrMrP op_cntrmaskrErWrZr\r^r`rbrdrfrhrjrlrnrprrrtrvrxrzr|r~rrrrrr rrrCs26"@  (    $K9 """""""""""""""""""""".*9r r)rlrnrqrsrvryr|)r closepathrr)rhsbwrrrrr)r dotsection))r rvstem3))r r.hstem3))r rwseac))r rzsbwr))r r: callothersubr))r r.))r !setcurrentpointceZdZfdZxZS)T2StackUseExtractorc>dfd}t||S)Nrczjj|ttjyr?)rrmaxrd)r maxStackUsers rrz0T2StackUseExtractor.execute..pushToStack0s.    $ $U +k3t/@/@+ABKr r)superr))rr!rr __class__s` @rr)zT2StackUseExtractor.execute-s&  C  <r )rrrr) __classcell__rs@rrr+s   r rcDeZdZ d dZdZd dZdZdZdZdZ d Z y) T2WidthExtractorNcRtj|||||||_||_yr?)rr  nominalWidthX defaultWidthX)rrrrrrr s rr zT2WidthExtractor.__init__:s* ##D*k7GT**r cJtj|d|_d|_yr )rr gotWidthwidthrs rr zT2WidthExtractor.resetGs  &  r c|j}|jsY|t|dzz r0|jJd|j|dz|_|dd}n|j|_d|_|S)Nr.z5CFF2 CharStrings must not have an initial width valuerr)rrrdrrr)revenOddrTs r popallWidthzT2WidthExtractor.popallWidthLs~{{}}}#d)a-(&&2KJK2!//$q'9 ABx!// DM r cd|j}|jt|dzz|_yrR)rrrdrSs rrEzT2WidthExtractor.countHints[s(!#d)q.8r c$|jyr?rr5s r op_rmovetozT2WidthExtractor.op_rmoveto_ r c&|jdyNrrr5s r op_hmovetozT2WidthExtractor.op_hmovetob r c&|jdyrrr5s r op_vmovetozT2WidthExtractor.op_vmovetoerr c$|jyr?rr5s rr8zT2WidthExtractor.op_endcharhrr rr) rrrr r rrErrrr8rr rrr9s2 + 9r rcVeZdZ d5dZdZfdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!d Z"d!Z#d"Z$d#Z%d$Z&d%Z'd&Z(d'Z)d(Z*d)Z+d*Z,d+Z-d,Z.d-Z/d.Z0d/Z1d0Z2d1Z3d2Z4d3Z5d4Z6xZ7S)6T2OutlineExtractorc Vtj|||||||||_d|_yr )rr pen subrLevel)rrrrrrrr s rr zT2OutlineExtractor.__init__ms7 !!        r cXtj|d|_d|_d|_y)Nrrr)rr  currentPoint sawMoveTorrs rr zT2OutlineExtractor.resets&t$"r c|xjdz c_t| ||xjdzc_|jdk(r|jyyNrr)rrr)endPath)rr!rs rr)zT2OutlineExtractor.executesE !  # ! >>Q  LLN r cR|j\}}||dz||dzf}||_|Sr)r)rpointrys r _nextPointzT2OutlineExtractor._nextPoints8  1E!H a%(l*! r cf|jj|j|d|_yr)rmoveTorrrrs rrMoveTozT2OutlineExtractor.rMoveTos" ./r c|js|jd|jj|j |yNr)rrrlineTorrs rrLineTozT2OutlineExtractor.rLineTos.~~ LL  ./r c|js|jd|j}|jj ||||||yr)rrrrcurveTo)rpt1pt2pt3 nextPoints rrCurveTozT2OutlineExtractor.rCurveTos@~~ LL OO  333Hr c^|jr|jjd|_yr )rr closePathrs rrzT2OutlineExtractor.closePaths >> HH   r c>|jr|jyyr?)rrrs rrzT2OutlineExtractor.endPaths >> NN  r cb|j|j|jyr?rrrr5s rrzT2OutlineExtractor.op_rmovetos   T%%'(r cn|j|j|jdddfyrrr5s rrzT2OutlineExtractor.op_hmovetos,  d&&q)!,a01r cn|j|jd|jddfyrrr5s rrzT2OutlineExtractor.op_vmovetos,  a))!,Q/01r c |j|j}|rVddlm}|\}}}}||}|jj |d||} |jj | dddd||fyy)NrStandardEncodingrrrrrrr)rr$fontTools.encodings.StandardEncodingrr addComponent) rrrTradxadybcharachar baseGlyph accentGlyphs rr8zT2OutlineExtractor.op_endchars~ !  M&* "CeU(/I HH ! !)-? @*51K HH ! !+1aC/E F r c|j}tdt|dD]}|||dz}|j|y)Nrr.)rrrdr)rrrTrrs r op_rlinetozT2OutlineExtractor.op_rlinetosD{{}q#d)Q' AQUOE LL  r c&|jdyralternatingLinetor5s r op_hlinetozT2OutlineExtractor.op_hlineto q!r c&|jdyr rr5s r op_vlinetozT2OutlineExtractor.op_vlinetorr c|j}tdt|dD]*}|||dz\}}}}}} |j||f||f|| f,y)z${dxa dya dxb dyb dxc dyc}+ rrcurvetorrwN)rrrdr) rrrTrdxadyadxbdybdxcdycs r op_rrcurvetozT2OutlineExtractor.op_rrcurvetosk{{}q#d)Q' >AQQ  MM3*sCj3* = >r c|j}tdt|dz dD]*}|||dz\}}}}}} |j||f||f|| f,|j |ddy)z-{dxa dya dxb dyb dxc dyc}+ dxd dyd rcurvelinerr.rwN)rrrdrr) rrrTrrrrrdxddyds r op_rcurvelinez T2OutlineExtractor.op_rcurvelinesy{{}q#d)a-+ >A+/AE? (Cc3S MM3*sCj3* = > T"#Yr c|j}|dd}tdt|dD]}|j|||dz|dd\}}}}} } |j ||f||f| | fy)z-{dxa dya}+ dxb dyb dxc dyc dxd dyd rlinecurveNirr.)rrrdrr) rrrTlineArgsrrrrrrrs r op_rlinecurvez T2OutlineExtractor.op_rlinecurves{{}9q#h-+ .A LL!a!e, - .'+BCy$S#sC sCj3*sCj9r c|j}t|dzr |d}|dd}nd}tdt|dD]*}|||dz\}}}}|j||f||fd|fd},y)z!dx1? {dya dxb dyb dyc}+ vvcurvetor.rrNr7rrdrr) rrrTdx1rrrrrs r op_vvcurvetozT2OutlineExtractor.op_vvcurvetos{{} t9q=q'C8DCq#d)Q' A!%a!a% Cc3 MM3*sCj1c( ;C r c|j}t|dzr |d}|dd}nd}tdt|dD]*}|||dz\}}}}|j||f||f|dfd},y)z!dy1? {dxa dxb dyb dxc}+ hhcurvetor.rrNr7r ) rrrTdy1rrrrrs r op_hhcurvetozT2OutlineExtractor.op_hhcurvetos{{} t9q=q'C8DCq#d)Q' A!%a!a% Cc3 MM3*sCj3( ;C r cx|j}|r(|j|}|r|j|}|r'yy)zdy1 dx2 dy2 dx3 {dxa dxb dyb dyc dyd dxe dye dxf}* dyf? vhcurveto (30) {dya dxb dyb dxc dxd dxe dye dyf}+ dxf? vhcurveto N)rvcurvetohcurvetorrrTs r op_vhcurvetozT2OutlineExtractor.op_vhcurveto*6{{}==&D}}T*r cx|j}|r(|j|}|r|j|}|r'yy)zpdx1 dx2 dy2 dy3 {dya dxb dyb dxc dxd dxe dye dyf}* dxf? {dxa dxb dyb dyc dyd dxe dye dxf}+ dyf? N)rrrrs r op_hvcurvetozT2OutlineExtractor.op_hvcurveto4rr c|j\}}}}}}}dx} x} x} } | } |j|| f||f|| f|j|| f|| f|| fyr rr)rrrdx2dy2dx3dx4dx5dx6rdy3dy4dy6dy5s rop_hflexzT2OutlineExtractor.op_hflexAso,0KKM)S#sCc !!!c!C#d sCj3*sCj9 sCj3*sCj9r c |j\ }}}}}}}} } } } } }|j||f||f||f|j|| f| | f| | fyr?r)rrrrrrrr#r r$r!r&r"r%fds rop_flexzT2OutlineExtractor.op_flexHs`IMFS#sCc3S#sB sCj3*sCj9 sCj3*sCj9r c |j\ }}}}}}}} } dx} } ||z| z| z| z } |j||f||f|| f|j|| f|| f| | fyr r)rrrrrrrr r!r&r"r#r$r%s r op_hflex1zT2OutlineExtractor.op_hflex1Ms{6:kkm3S#sCc3 cc C#%+, sCj3*sCj9 sCj3*sCj9r c |j\ }}}}}}}} } } } ||z|z|z| z} ||z|z| z| z}t| t|kDr| }| }n| }| }|j||f||f||f|j|| f| | f||fyr?)rrr)rrrrrrrr#r r$r!r&d6dxdyr"r%s rop_flex1zT2OutlineExtractor.op_flex1Us?C{{}<S#sCc3S" 3Y_s "S ( 3Y_s "S ( r7SW C#C#CC sCj3*sCj9 sCj3*sCj9r ctr?rVr5s rrWzT2OutlineExtractor.op_andcrXr ctr?rVr5s rrZzT2OutlineExtractor.op_orfrXr ctr?rVr5s rr\zT2OutlineExtractor.op_notirXr ctr?rVr5s rr^zT2OutlineExtractor.op_storelrXr ctr?rVr5s rr`zT2OutlineExtractor.op_absorXr ctr?rVr5s rrbzT2OutlineExtractor.op_addrrXr ctr?rVr5s rrdzT2OutlineExtractor.op_suburXr c|j}|j}||z}||z }||k(r|j|y|j|yr?)r.r3)rrnum2num1d1d2s rrfzT2OutlineExtractor.op_divxsGxxzxxz T\ D[ 8 IIbM IIbMr ctr?rVr5s rrhzT2OutlineExtractor.op_loadrXr ctr?rVr5s rrjzT2OutlineExtractor.op_negrXr ctr?rVr5s rrlzT2OutlineExtractor.op_eqrXr ctr?rVr5s rrnzT2OutlineExtractor.op_droprXr ctr?rVr5s rrpzT2OutlineExtractor.op_putrXr ctr?rVr5s rrrzT2OutlineExtractor.op_getrXr ctr?rVr5s rrtzT2OutlineExtractor.op_ifelserXr ctr?rVr5s rrvzT2OutlineExtractor.op_randomrXr ctr?rVr5s rrxzT2OutlineExtractor.op_mulrXr ctr?rVr5s rrzzT2OutlineExtractor.op_sqrtrXr ctr?rVr5s rr|zT2OutlineExtractor.op_duprXr ctr?rVr5s rr~zT2OutlineExtractor.op_exchrXr ctr?rVr5s rrzT2OutlineExtractor.op_indexrXr ctr?rVr5s rrzT2OutlineExtractor.op_rollrXr cp|j}|D]!}|r|df}nd|f}|j|| }#yr )rr)r isHorizontalrTargrs rrz$T2OutlineExtractor.alternatingLinetosE{{} ,CaC LL ++L  ,r c|dd\}}}}|dd}t|dk(r|d}g}nd}|jd|f||f||f|SNr7rrrdr)rrTrrrrrs rrzT2OutlineExtractor.vcurvetos`!"1XS#sABx t9>q'CDC q#hc S#J7 r c|dd\}}}}|dd}t|dk(r|d}g}nd}|j|df||f||f|SrPrQ)rrTrrrrrs rrzT2OutlineExtractor.hcurvetos`!"1XS#sABx t9>q'CDC sAhc S#J7 r r)8rrrr r r)rrrrrrrrrr8rrrrrr rrrrr'r*r,r1rWrZr\r^r`rbrdrfrhrjrlrnrprrrtrvrxrzr|r~rrrrrrrs@rrrls,  0 I  6)22 G" "" > :  ++:: : :""""""""""""""""""""" ,  r rceZdZdZdZdZddZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZdZdZdZdZdZy)T1OutlineExtractorc@||_||_|jyr?)rsubrsr )rrrVs rr zT1OutlineExtractor.__init__s  r cXd|_d|_d|_tj |yr )flexingrsbxrr rs rr zT1OutlineExtractor.resets%    &r c^|jr|jjd|_yr )rrrrs rrzT1OutlineExtractor.endPaths >> HH   r c"|jSr?r)rrs rrzT1OutlineExtractor.popallWidth{{}r c>|j}|d|dc|d<|d<y)Nrrr,r0s rrzT1OutlineExtractor.exchs)!!$Ry%)b 59r c||jry|j|j|jyr?)rXrrrr5s rrzT1OutlineExtractor.op_rmovetos' <<   T[[]#r c|jr|jdy|j|j|j ddfyr )rXr3rrrr5s rrzT1OutlineExtractor.op_hmovetos< << IIaL   dkkmA&*+r c|jr"|jd|jy|j|j d|j dfyr )rXr3rrrrr5s rrzT1OutlineExtractor.op_vmovetosE << IIaL IIK   aq)*+r c$|jyr?)rr5s r op_closepathzT1OutlineExtractor.op_closepaths  r c@|j}|\}}||f|_yr?)rr)rrrTrrs rop_setcurrentpointz%T1OutlineExtractor.op_setcurrentpoints"{{}1qDr c$|jyr?)rr5s rr8zT1OutlineExtractor.op_endchar s  r cr|j\}}||_||_||jdf|_yr)rrrYr)rrrYwxs rop_hsbwzT1OutlineExtractor.op_hsbw s7++-R !2!21!55r c$|jyr?r\r5s rop_sbwzT1OutlineExtractor.op_sbw  r cd|j}|j|}|j|yr?)r.rVr)r=s rr@zT1OutlineExtractor.op_callsubrs'HHJ zz)$ Tr c|j}|j}|dk(r|dk(r|jd|_y|dk(r|dk(rd|_yyy)Nrror)r.doFlexrX)rrr>nArgss rop_callothersubrz#T1OutlineExtractor.op_callothersubrsPHHJ   >eqj KKMDL !^ DL!+^r cyr?rr5s rop_popzT1OutlineExtractor.op_pop'r9r cP|j}|j}|j|j}|j}|j}|j}|j}|j}|j} |j} |j} |j} |j} |j}|j}|j}|j||z|j| |z|j| |j| |j| |j| |jd|j||j||j||j||j||j||jd|j||j|yr?)r.r3r)rfinalyfinalxp3yp3xbcp4ybcp4xbcp3ybcp3xp2yp2xbcp2ybcp2xbcp1ybcp1xrpyrpxs rrozT1OutlineExtractor.doFlex*s  hhjhhj    hhjhhj    hhjhhj %#+ %#+ % % # # $ % % % % # # $ & &r c$|jyr?r\r5s r op_dotsectionz T1OutlineExtractor.op_dotsectionTrlr c$|jyr?r\r5s r op_hstem3zT1OutlineExtractor.op_hstem3Wrlr c ddlm}|j\}}}}}||}|jj |d||} ||j z|z }|jj | dddd||fy)zasb adx ady bchar achar seacrrrrN)rrrrrrY) rrrasbrrrrrrs rop_seaczT1OutlineExtractor.op_seacZswI&*kkm#S#ue$U+  i);<&u- DHHns" kAq!QS+ABr c$|jyr?r\r5s r op_vstem3zT1OutlineExtractor.op_vstem3erlr Nr)rrrr r rrrrrrrcrer8rirkr@rqrsrorrrrrr rrTrTsm '  4$ ,,! 6   (T Cr rTceZdZeZee\ZZe Z e Z ddZ ddZdZdZdZdZddZd Zdd Zd Zd Zd ZeeefdZdZdZddZdZ y) T2CharStringNcZ|g}||_||_||_||ng|_d|_yr?)bytecoder"rr _cur_vsindex)rrr"rrs rr zT2CharString.__init__os8 ?G    *5*A;r r c|j}|J|||_n+|jt|dr |jnd|_|j |jS)Nrr)rrhasattrrr)rrpds rrzT2CharString.getNumRegionsxs] \\~~   'D     &.5b).D !D  1 122r c|j$d|jjt|fzSd|jjt|fzS)Nz<%s (source) at %x>z<%s (bytecode) at %x>)rrridrs r__repr__zT2CharString.__repr__sH == (DNN,C,CRX+NN N*dnn.E.Er$x-PP Pr ctSr?)rrs rrzT2CharString.getIntEncoderr ctSr?)rrs rgetFixedEncoderzT2CharString.getFixedEncoderrr c|jsyt|jdg}|j||j|j}|j |yNSubrs)rrrdecompilerClassrr))rrV decompilers r decompilezT2CharString.decompilesO&&(  gr2))%1A1A4<<P 4 r c t|jdg}|j|||j|jj|jj |j|}|j ||j|_yr)rroutlineExtractorrrrr)r)rrr rV extractors rdrawzT2CharString.drawsr gr2))      LL & & LL & & LL   $__ r cRt|}|j||jSr?)r rbounds)rglyphSet boundsPens r calcBoundszT2CharString.calcBoundss$h'  )r cH|jy|j}|j}|r|r-|ddvr&|dd}n |rt|dts t dg}|j }|j}d}t|}||kr||} |dz}t| tr: |jd|| D| dvr}|j|||dz}nct| tr|j|| n;t| tr|j|| nJd t| z||kr t|}|j'|y#t$rt d| zwxYw#t $rt"j%|wxYw) Nr)rrz@T2CharString or Subr has items on the stack after last operator.rrc32K|]}t|ywr?)r).0rJs r z'T2CharString.compile..s#G1GAJ#Gszillegal operator: %srrzunsupported type: %s)ropcodesr"restrrrrrdextendrrrrHtyper TypeErrorrerror setBytecode) risCFF2rr"rrrrendr$s rcompilezT2CharString.compiles == $ ,,,, 72;*??!#2, Z S9(R &&( **, 'l#gAJEAA%%QOO#G#GG44OOGAJ/AAE3' % 01E5) E 23>04;>>q!#g"  *H "! Q01G%1OPPQ  IIh   s&E& F&E> F!c|jduSr?)rrs rrzT2CharString.needsDecompilations}}D((r c ||_d|_yr?)r"r)rr"s rr zT2CharString.setPrograms  r c ||_d|_yr?)rr")rrs rrzT2CharString.setBytecodes   r cB|jX|||jk\ry||j|}|dz}|j|}||||j|\}}n*|||jk\ry|j|}|dz}||t}|||fS)N)Nrrr)roperandEncodingr"r) rrrdrrerr'r$r%s rrzT2CharString.getTokens == $DMM**!u-.BAIE**2.G"4T]]EBLE5DLL))!LL'EAIEs+ j%''r c|j||z}|j||}|}n|j|}|dz}t||k(sJ||fSr)rr"rd)rrnBytesnewIndexbytess rrOzT2CharString.getBytess] == $v~HMM%1EELL'EAIE5zV###e|r c|Sr?r)rrs rrzT2CharString.handle_operatorsr cddlm}|j|j|jyd}g} |j |\}}}|n|r|dvra|j |\}}}g} |D]#} | j |t | d%t| }dj|||gz} ndj||gz} |j| |jg}n:t|trt|d}n t|}|j ||r#dj|} |j| yy)Nr) num2binaryrr} r:r;)fontTools.misc.textToolsrrdumphexrrrr joinwritenewlinererHrr) r xmlWriterttFontrrrTr$r%hintMaskbitsbytelines rtoXMLzT2CharString.toXMLs@7 == $   dmm ,ED+/==+?(z5= 886:mmE6J3*e!$,FD KK 74=!(DEF#*4="xxx/@(@A"xxw7OOD)%%'D!%/ 1%r J #E KK&-.xx~% r c ddlm}m}|jdr|j ||yt |}|j }g}t|}d}||kr-||} |dz} t| } |j| ||kr-|j|y#t$r t| d} |j| nv#t$rj|j| | dvrR||} d} tdt| d D]} | t|| | | d zz} |j| |dz}YnwxYwYwxYw) Nr) binary2numreadHexrawrr:r;rr r})rrrrrr rrdrr ValueErrorrrrr ) rnameattrscontentrrr"rrr$mask maskBytesjs rfromXMLzT2CharString.fromXML"sT@ 99U    WW- . '"--/'l #gAJEAA &E  u%)#g*  ! * *-e2FENN5)""NN5) 88&qz$' !&q#d)Q!7YA(1GJtAPQTUPU.encodeFixedQsVW Wr r)rrs rrzT1CharString.getFixedEncoderPs Xr c|jyg}d} |j|\}}}|n|j|*|j|yr )rrrr )rr"rr$r%s rrzT1CharString.decompileTsX == '+}}U'; $E:u} NN5 !   r ctt||j}|j||j|_yr?)rTrVr)r)rrrs rrzT1CharString.draw`s+&sDJJ7 $__ r )NNN)rrrt1OperandEncodingrrk t1Operatorsrrr rrrrrrs@rrrEs1'O*;7IwX !%r rcZeZdZeZddZdZdZdZdZ dZ dZ d Z d Z d Zd Zd Zy)DictDecompilerNc<g|_||_i|_||_yr?)r1stringsdictparent)rrrs rr zDictDecompiler.__init__is    r cXt|jdk(sJd|jS)Nrznon-empty stack)rdr1rrs rgetDictzDictDecompiler.getDictos(4::!#6%66#yyr cd}t|}|jj}||krAt||}|dz}|j|}|||||\}}|||||kr@yyr)rdr1rrr)rrrlenDatar3rr'rs rrzDictDecompiler.decompilesswd)zz  goe%BAIE**2.G"4T59LE5 U gor c>|jd}|jd=|Sr+r1r-s rr.zDictDecompiler.pops 2 JJrN r cB|jdd}|jdd=|Sr?rrSs rrzDictDecompiler.popallszz!} JJqM r c>|\}}t|trAd}tt|dz ddD]"}||}t |d|z}||f|z}$nt |d|z}||}|dk(r|j j |y||j|<y)Nrrrarg_r)rerfrrdrr1rr)rrargTyperrrN arghandlers rrzDictDecompiler.handle_operators$' gu %E3wr'sL JI. g! 2 3   < !  FSL-0!B%)4"S'N+;;#c'N+;;#c%# $$$%a(%"'#*1-)r,r+s "%.k$:;DAq1a4;   8 v1hU# D! D!  + gcl* 1 h Y G9G9T < , 0)0fa)aH V+VrY!6Y!x%<%BvVvrQ+