Warning: session_start(): Session cannot be started after headers have already been sent in /home/tvrreohg/public_html/manga.php on line 13
3 2øªj>aã@s~dZddlmZdd„Zdd„Zd0dd „Zd d „Zd d „Zdd„ZGdd„de ƒZ dd„Z d1dd„Z d2dd„Z dd„Zdd„Zdd„Zdd „Zd!d"„Zd3d%d&„Zd4d'd(„Zed)k�rzddlZeejƒd*krâddlZejejƒjƒeejd*d…ƒZed+ƒeeeƒƒeeƒZed,ƒeeƒeeƒZ ed-ƒeee ƒƒee k�sJt!‚ed.ƒeee eƒƒƒed/ƒeeeeƒƒƒdS)5aZT2CharString operator specializer and generalizer. PostScript glyph drawing operations can be expressed in multiple different ways. For example, as well as the ``lineto`` operator, there is also a ``hlineto`` operator which draws a horizontal line, removing the need to specify a ``dx`` coordinate, and a ``vlineto`` operator which draws a vertical line, removing the need to specify a ``dy`` coordinate. As well as decompiling :class:`fontTools.misc.psCharStrings.T2CharString` objects into lists of operations, this module allows for conversion between general and specific forms of the operation. é)Ú maxStackLimitcCsvt|tƒr|jƒ}g}xZ|D]R}y t|ƒ}Wn6tk rby t|ƒ}Wntk r\YnXYnX|j|ƒqW|S)N)Ú isinstanceÚstrÚsplitÚintÚ ValueErrorÚfloatÚappend)ÚstringÚprogramÚtoken©r úA/tmp/pip-build-_d5lkt3n/fonttools/fontTools/cffLib/specializer.pyÚstringToPrograms     rcCsdjdd„|DƒƒS)Nú css|]}t|ƒVqdS)N)r)Ú.0Úxr r rú $sz"programToString..)Újoin)r r r rÚprogramToString#srNc Cs²d}d}d}d}g}g}t|ƒ}�xv|D�]l} t| tƒsD|j| ƒq(| dkr²|dk sXt‚d||ƒ} |d} | | d} || d…g|| d…<|| t|ƒd7}t|ƒ}q(n�| dkrÔ|d}t|ƒtksÒt‚nn| oà| dk�rBd}| dk} |�r |t||d…ƒ}nt|ƒ}|�rB|d| A�rB|jdƒ}|jd|gfƒ| dk�r„|�r`|jd|fƒ|j| gfƒ|jdt |ƒgfƒn|j| |fƒg}q(W|�r®|jd|fƒ|S)uœTakes a T2CharString program list and returns list of commands. Each command is a two-tuple of commandname,arg-list. The commandname might be empty string if no commandname shall be emitted (used for glyph width, hintmask/cntrmask argument, as well as stray arguments at the end of the program (¯\_(ツ)_/¯). 'getNumRegions' may be None, or a callable object. It must return the number of regions. 'getNumRegions' takes a single argument, vsindex. If the vsindex argument is None, getNumRegions returns the default number of regions for the charstring, else it returns the numRegions for the vsindex. The Charstring may or may not start with a width value. If the first non-blend operator has an odd number of arguments, then the first argument is a width, and is popped off. This is complicated with blend operators, as there may be more than one before the first hint or moveto operator, and each one reduces several arguments to just one list argument. We have to sum the number of arguments that are not part of the blend arguments, and all the 'numBlends' values. We could instead have said that by definition, if there is a blend operator, there is no width value, since CFF2 Charstrings don't have width values. I discussed this with Behdad, and we are allowing for an initial width value in this case because developers may assemble a CFF2 charstring from CFF Charstrings, which could have width values. FNrÚblendéZvsindexÚhstemÚhstemhmÚvstemÚvstemhmÚcntrmaskÚhintmaskÚhmovetoÚvmovetoÚrmovetoÚendcharTéÚéÿÿÿÿr$> rrrrrr!rrrr >rr>rr) Úiterrrr ÚAssertionErrorÚlenÚtyperÚpopÚnext)r Ú getNumRegionsZ seenWidthOpZvsIndexZ lenBlendStackZlastBlendIndexÚcommandsÚstackÚitr ZnumSourceFontsÚ numBlendsZ numBlendArgsZparityZnumArgsÚwidthr r rÚprogramToCommands'sZ       r1cCs@g}x6|D].}t|tƒr.|j|ƒ|jdƒq |j|ƒq W|S)Nr)rÚlistÚextendr )ÚargsZ token_listÚargr r rÚ_flattenBlendArgs|s    r6cCsLg}xB|D]:\}}tdd„|Dƒƒr,t|ƒ}|j|ƒ|r |j|ƒq W|S)znTakes a commands list as returned by programToCommands() and converts it back to a T2CharString program list.css|]}t|tƒVqdS)N)rr2)rr5r r rr‹sz$commandsToProgram..)Úanyr6r3r )r,r Úopr4r r rÚcommandsToProgram†s r9ccsHt|ƒ|dkrt|ƒ‚x*tdt|ƒ|ƒD]}||||…Vq*WdS)z'Group the list el into groups of size nrN)r'rÚrange)ÚelÚnÚir r rÚ_everyN“sr>c@s¨eZdZedd„ƒZedd„ƒZedd„ƒZedd„ƒZed d „ƒZed d „ƒZ ed d„ƒZ edd„ƒZ edd„ƒZ edd„ƒZ edd„ƒZedd„ƒZedd„ƒZdS)Ú!_GeneralizerDecombinerCommandsMapccs"t|ƒdkrt|ƒ‚d|fVdS)Nr"r )r'r)r4r r rr œs z)_GeneralizerDecombinerCommandsMap.rmovetoccs*t|ƒdkrt|ƒ‚d|ddgfVdS)Nrr r)r'r)r4r r rr s z)_GeneralizerDecombinerCommandsMap.hmovetoccs*t|ƒdkrt|ƒ‚dd|dgfVdS)Nrr r)r'r)r4r r rr¤s z)_GeneralizerDecombinerCommandsMap.vmovetoccs.|s t|ƒ‚xt|dƒD]}d|fVqWdS)Nr"Úrlineto)rr>)r4r r rr@©sz)_GeneralizerDecombinerCommandsMap.rlinetoc cs\|s t|ƒ‚t|ƒ}y.x(dt|ƒdgfVddt|ƒgfVqWWntk rVYnXdS)Nr@r)rr%r*Ú StopIteration)r4r.r r rÚhlineto®sz)_GeneralizerDecombinerCommandsMap.hlinetoc cs\|s t|ƒ‚t|ƒ}y.x(ddt|ƒgfVdt|ƒdgfVqWWntk rVYnXdS)Nr@r)rr%r*rA)r4r.r r rÚvlineto¸sz)_GeneralizerDecombinerCommandsMap.vlinetoccs.|s t|ƒ‚xt|dƒD]}d|fVqWdS)NéÚ rrcurveto)rr>)r4r r rrEÂsz+_GeneralizerDecombinerCommandsMap.rrcurvetoccs¨t|ƒdkst|ƒddkr$t|ƒ‚t|ƒddkrjd|d|d|d|d|ddgfV|dd…}x8t|dƒD]*}d|dd|d|d|ddgfVqvWdS)Nérr"rEréé)r'rr>)r4r r rÚ hhcurvetoÇs* z+_GeneralizerDecombinerCommandsMap.hhcurvetoc cs¨t|ƒdkst|ƒddkr$t|ƒ‚t|ƒddkrjd|d|d|d|dd|dgfV|dd…}x8t|dƒD]*}dd|d|d|dd|dgfVqvWdS)NrFrr"rErrGrH)r'rr>)r4r r rÚ vvcurvetoÏs* z+_GeneralizerDecombinerCommandsMap.vvcurvetoccsRt|ƒdkst|ƒdd kr$t|ƒ‚d}t|ƒddkrbt|ƒddk}|dd …|d d…}}t|dƒ}yfx`t|ƒ}d|dd|d|dd|dgfVt|ƒ}dd|d|d|d|ddgfVqpWWntk ræYnX|�rN|}|�r$d|dd|d|d|d|dgfVn*dd|d|d|d|d|dgfVdS) NrFérrrHr"rErG>rrrFrHéûÿÿÿrL)r'rr>r*rA)r4Ú last_argsÚ lastStraightr.r r rÚ hvcurveto×s( &.,z+_GeneralizerDecombinerCommandsMap.hvcurvetoccsRt|ƒdkst|ƒdd kr$t|ƒ‚d}t|ƒddkrbt|ƒddk}|dd …|d d…}}t|dƒ}yfx`t|ƒ}dd|d|d|d|ddgfVt|ƒ}d|dd|d|dd|dgfVqpWWntk ræYnX|�rN|}|�r$dd|d|d|d|d|dgfVn*d|dd|d|d|d|dgfVdS) NrFrKrrrHr"rErG>rrrFrHrLrL)r'rr>r*rA)r4rMrNr.r r rÚ vhcurvetoís( &.,z+_GeneralizerDecombinerCommandsMap.vhcurvetoccsjt|ƒdkst|ƒddkr$t|ƒ‚|dd…|dd…}}xt|dƒD]}d|fVqJWd|fVdS)NrKrDr"rEr@éþÿÿÿrQ)r'rr>)r4rMr r rÚ rcurvelines z,_GeneralizerDecombinerCommandsMap.rcurvelineccsjt|ƒdkst|ƒddkr$t|ƒ‚|dd…|dd…}}xt|dƒD]}d|fVqJWd|fVdS) NrKr"rrDr@rEiúÿÿÿiúÿÿÿ)r'rr>)r4rMr r rÚ rlinecurve s z,_GeneralizerDecombinerCommandsMap.rlinecurveN)Ú__name__Ú __module__Ú __qualname__Ú staticmethodr rrr@rBrCrErIrJrOrPrRrSr r r rr?šs          r?csÄtdd„|Dƒƒr"dd„|Dƒ}n|}|d }|dd …}t|ƒ|d‰|ˆdt|ƒksft|ƒ‚dd„|d|…Dƒ}||d…‰tˆƒ}‡‡fdd„td|ˆƒDƒ}dd„t||ƒDƒ}|S) NcSsg|]}t|tƒ‘qSr )rr2)rr5r r rú sz)_convertBlendOpToArgs..cSs.g|]&}t|tƒrt|ƒn|gD]}|‘q qSr )rr2Ú_convertBlendOpToArgs)rÚer=r r rrXsrcSsg|] }|g‘qSr r )rr5r r rrX/scsg|]}ˆ||ˆ…‘qSr r )rr=)Ú deltaArgsÚ numRegionsr rrX2srcSsg|]\}}||‘qSr r )rÚaÚbr r rrX3sr$r$)r7r'rr:Úzip)Z blendListr4r/Z defaultArgsZnumDeltaValuesZ deltaListÚ blend_argsr )r[r\rrYs   rYFcCsúg}t}xì|D]ä\}}tdd„|Dƒƒrvydd„|Dƒ}Wn:tk rt|rn|jd|fƒ|jd|gfƒn‚YnXt||dƒ}|s–|j||fƒqy x||ƒD]}|j|ƒq¢WWqtk rð|rê|jd|fƒ|jd|gfƒn‚YqXqW|S)NcSsg|]}t|tƒ‘qSr )rr2)rr5r r rrX;sz&generalizeCommands..cSs.g|]&}t|tƒrt|ƒn|gD]}|‘q qSr )rr2rY)rr5r<r r rrX=sr#)r?r7rr Úgetattr)r,Ú ignoreErrorsÚresultÚmappingr8r4ÚfuncÚcommandr r rÚgeneralizeCommands6s0  rgcKsttt||ƒf|ŽƒS)N)r9rgr1)r r+Úkwargsr r rÚgeneralizeProgramXsricCsV|ds2|ds d|dd…fSd|dd…fSn |dsJd|dd…fSd|fSdS)ab Takes X,Y vector v and returns one of r, h, v, or 0 depending on which of X and/or Y are zero, plus tuple of nonzero ones. If both are zero, it returns a single zero still. >>> _categorizeVector((0,0)) ('0', (0,)) >>> _categorizeVector((1,0)) ('h', (1,)) >>> _categorizeVector((0,2)) ('v', (2,)) >>> _categorizeVector((1,2)) ('r', (1, 2)) rrÚ0NÚvÚhÚrr )rkr r rÚ_categorizeVector\srncCs(|dkr |S|dkr|S||kr$|SdS)Nrjr )r]r^r r rÚ_mergeCategoriesvsrocCs(|dkr dS|dkrdS|dks$t‚|S)NrlrkZ0r)r&)r]r r rÚ_negateCategory|s  rpc Cs*t|ƒ}d}g}d}�x||k�r$||}t|tƒsP|j|ƒ|d7}|d7}q|}t|ƒ}|g}|d7}|d|7}xF||kr¼t||tƒr¼|j||ƒ|d7}||7}||tkrxPqxWt|ƒ} g} x|D]}| j|dƒqÐWx|D]}| j|dd…ƒqìW| j| ƒ|j| ƒ|| }qW|S)Nrr)r'rr2r rr3) r4Únum_argsZ stack_useÚnew_argsr=r5Zprev_stack_useZ num_sourcesZ blendlistZ num_blendsr`r r rÚ_convertToBlendCmds‚s>          rscCsvt|tƒrHt|tƒr>t|ƒt|ƒkr*tƒ‚dd„t||ƒDƒS||}}t|tƒrnt|d|ƒg|dd…S||S)NcSsg|]\}}t||ƒ‘qSr )Ú_addArgs)rÚvaZvbr r rrXºsz_addArgs..rr)rr2r'rr_rt)r]r^r r rrtµs    rtTé0c Cs(|rt||d�}nt|ƒ}x˜tt|ƒddd!ƒD]€}d||dkoZ||ddknr0||dd||d}}d|d|d|d|dgf||d<||=q0Wx¦tt|ƒƒD]–}||\}} |d"k�rt| ƒ\} } | |dd…| f||<qÂ|dkrÂt| dd…ƒ\} } t| d#d…ƒ\} }| | d| | dd …|f||<qÂqÂW|�sŽ�x(tt|ƒdd$d%ƒD�]}||\}} |d k�rÐt| ƒd k�s¨t‚t| dd …ƒ\} } | d }|| f||<|d k�rä||=�qz|�rz|d&k�rz|||ddk�rz||d\}}t| ƒdk�r6t|ƒdk�s:t‚yt| d|dƒg}Wntk �rl�wzYnX||f||d<||=�qz�qzW�xˆtdt|ƒdƒD�]p}||\}} ||dd||dd}}|d'k�rF||k�oödkn�rFt| ƒdk�st‚|ddk�r*d| dgn | ddg} d| f||<�q¤|dd…dk�r¤t| ƒdk�r¤||k�ozdkn�r¤|ddk|ddkA�s t‚|ddk�r´d}n,|ddk�rÈd}n|ddk�rÜd }nd}| d|…t| ƒd(ƒ| |d…} d| f||<�q¤�q¤W�xtt|ƒddd)ƒD�]}||d\}} ||\}}d}||hddhk�r®||k�rz|}n0|dk�r˜t|ƒdk�r˜d}nt|ƒdk�rþd}�nP||fd,k�rÄ|}�n:||hddhk�rÞ|}�n d|dd…k�o|dd…kn�rþ|dd…\}}|dd…\}}|dk�s2|dk�s2||k�oRdkn�r^�q2t ||ƒ}|dk�rv�q2|dk�r¦t ||ƒ}|dk�r˜�q2d|d}nX|dk�rÚt |t |ƒƒ}|dk�rÌ�q2|dd}n$t ||ƒ}|dk�rò�q2||d}|�r2t| ƒt|ƒ|k�r2|| |f||d<||=�q2W�xžtt|ƒƒD�]Œ}||\}} |d-k�r‚d|dd…| f||<�qJ|dd…dk�rJ|dd…d.k�rJ|dd…\}}|dk|dkA�rÞt| ƒddk�sÞt‚|dk�rìd}|dk�rúd}|dk�r|}|dk�rt |ƒ}||hddhk�s8t||fƒ‚t| ƒd�r¾||k�r�|dkt| ƒddkA�r¾| dd/…| d0d…| d1d2…} n.|dk�r¾| dd…| dd…| dd…} ||d| f||<�qJ�qJWxFtt|ƒƒD]6}||\}} t dd „| Dƒƒ�rê|t | ƒf||<�qêW|S)3N)rbrrr r@rEr"ZcurvetorFZ 00curvetorGZlinetoÚ0linetorBrCrkrHrmrDrSrRÚ0movetorlÚrrÚhhÚvvÚvhÚhvrjrKcss|]}t|tƒVqdS)N)rr2)rr5r r rrØsz%specializeCommands..r$>r@r rQr$r$>rCrB>rCrBrw)rr$©r@rS©rErR>rr~>rxrw>r|ryrzr}r{rQr$rQr$) rgr2r:r'rnr&rtrr(rorpr7rs)r,rbZgeneralizeFirstZpreserveTopologyZmaxstackr=Zv1Zv2r8r4ÚcÚc1Zargs1Úc2Zargs2Ú_Z other_argsrrZprvZnxtÚposZop1Zop2Znew_opZd0Zd1Zd2Zd3ÚdZop0r r rÚspecializeCommandsÂs(,, 0   $        "&& <$    ,0             $     & $  r†cKsttt||ƒf|ŽƒS)N)r9r†r1)r r+rhr r rÚspecializeProgramÝsr‡Ú__main__rzProgram:z Commands:zProgram from commands:zGeneralized program:zSpecialized program:)N)F)N)FTFrv)N)"Ú__doc__ZfontTools.cffLibrrrr1r6r9r>Úobjectr?rYrgrirnrorprsrtr†r‡rTÚsysr'ÚargvÚdoctestÚexitÚtestmodÚfailedr Úprintr,Zprogram2r&r r r rÚsT  U  y# " 3