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¢ã@s‚dZddlZddlZddlmZmZmZmZddlm Z ddl m Z ddl m Z ddl mZddlmZddlZd gZGd d „d eƒZejd ƒZeee jfZeeejd œdd„Ze jedœdd„Ze jeedœdd„Z eje jdœdd„Z!e fejee"ge"fejdœdd„Z#ejeejdœdd„Z$d)eee j%ej&eed œd!d"„Z'd*e j(eeeedd$œd%d „Z)d+d&d'„Z*e+d(k�r~e*ƒdS),zz Simplify TrueType glyphs by merging overlapping contours/components. Requires https://github.com/fonttools/skia-pathops éN)ÚCallableÚIterableÚOptionalÚMapping)ÚotRound)ÚttFont)Ú_g_l_y_f)Ú_h_m_t_x)Ú TTGlyphPenÚremoveOverlapsc@s eZdZdS)ÚRemoveOverlapsErrorN)Ú__name__Ú __module__Ú __qualname__©rrúC/tmp/pip-build-_d5lkt3n/fonttools/fontTools/ttLib/removeOverlaps.pyr sr zfontTools.ttLib.removeOverlaps)Ú glyphNameÚglyphSetÚreturncCs&tjƒ}|j|d�}||j|ƒ|S)N)r)ÚpathopsÚPathZgetPenÚdraw)rrÚpathZpathPenrrrÚskPathFromGlyphs r)Ú componentrcCs |jƒ\}}t||ƒ}|j|ŽS)N)ZgetComponentInforZ transform)rrZ baseGlyphNameZtransformationrrrrÚskPathFromGlyphComponent&s  r)Úglyphrrcshˆjƒstdƒ‚tˆjƒdkr"dSi‰ttjdœ‡‡‡fdd„ ‰t‡fdd„tj t tˆjƒƒdƒDƒƒS) Nz5This method only works with TrueType composite glyphséF)Úindexrcs$|ˆkrtˆj|ˆƒˆ|<ˆ|S)N)rÚ components)r)Úcomponent_pathsrrrrÚ_get_nth_component_path6sz2componentsOverlap.._get_nth_component_pathc3s2|]*\}}tjˆ|ƒˆ|ƒtjjddd�VqdS)F)Z fix_windingZkeep_starting_pointsN)rÚopZPathOpZ INTERSECTION)Ú.0ÚiÚj)r!rrú >sz$componentsOverlap..) Ú isCompositeÚ ValueErrorÚlenrÚintrrÚanyÚ itertoolsÚ combinationsÚrange)rrr)r!r rrrÚcomponentsOverlap.s r/)rrcCs:tdd�}|j|ƒ|jƒ}|jƒ s*t‚|jdd�|S)N)r)Ú glyfTable)r rrr'ÚAssertionErrorZ recalcBounds)rZttPenrrrrÚttfGlyphFromSkPathIs    r2)rÚroundrcs<tjƒ}x.|D]&\}}|j|f‡fdd„|DƒžŽqW|S)Nc3s&|]}ˆ|dƒˆ|dƒfVqdS)réNr)r#Úp)r3rrr&Ysz_round_path..)rrÚadd)rr3Z rounded_pathZverbZpointsr)r3rÚ _round_pathTs"r7)rÚdebugGlyphNamercCs¦ytj||jd�Stjk r&YnXt|ƒ}y tj||jd�}tjd|ƒ|Stjk r˜}z*tjtj ƒrx|j ƒt d|›�ƒ|‚WYdd}~XnXt dƒ‚dS)N)Ú clockwisezkskia-pathops failed to simplify '%s' with float coordinates, but succeded using rounded integer coordinatesz%Failed to remove overlaps from glyph Z Unreachable) rZsimplifyr9Z PathOpsErrorr7ÚlogÚdebugÚ isEnabledForÚloggingÚDEBUGÚdumpr r1)rr8ÚerrrÚ _simplify]s$   rAT)rrr0Ú hmtxTableÚ removeHintingrc Cs¬||}|jdks$|jƒrœt||ƒrœt||ƒ}t||ƒ}dd„|jDƒdd„|jDƒkrœt|ƒ||<}|j stt‚||\}} | |j kr˜||j f||<dS|r¨|j ƒdS)NrcSsh|] }t|ƒ’qSr)Útuple)r#Úcrrrú “sz(removeTTGlyphOverlaps..TF) ZnumberOfContoursr'r/rrAZcontoursr2Úprogramr1ZxMinrC) rrr0rBrCrrÚpath2ÚwidthZlsbrrrÚremoveTTGlyphOverlapss         rJF)ÚfontÚ glyphNamesrCrcsÔy |d‰Wntk r(tdƒ‚YnX|d}|jƒ}|dkrJ|jƒ}t|‡fdd„d�}tƒ}xR|D]J}yt||ˆ||ƒrŠ|j|ƒWqjtk r²|s¢‚t j d|ƒYqjXqjWt j d t |ƒd j |ƒƒdS) a½Simplify glyphs in TTFont by merging overlapping contours. Overlapping components are first decomposed to simple contours, then merged. Currently this only works with TrueType fonts with 'glyf' table. Raises NotImplementedError if 'glyf' table is absent. Note that removing overlaps invalidates the hinting. By default we drop hinting from all glyphs whether or not overlaps are removed from a given one, as it would look weird if only some glyphs are left (un)hinted. Args: font: input TTFont object, modified in place. glyphNames: optional iterable of glyph names (str) to remove overlaps from. By default, all glyphs in the font are processed. removeHinting (bool): set to False to keep hinting for unmodified glyphs. ignoreErrors (bool): set to True to ignore errors while removing overlaps, thus keeping the tricky glyphs unchanged (fonttools/fonttools#2363). Zglyfz-removeOverlaps currently only works with TTFsZhmtxNcs$ˆ|jƒrˆ|jˆƒjnd|fS)Nr)r'ZgetCompositeMaxpValuesZmaxComponentDepth)Úname)r0rrÚÌsz removeOverlaps..)Úkeyz"Failed to remove overlaps for '%s'z"Removed overlaps for %s glyphs: %sú )ÚKeyErrorÚNotImplementedErrorZ getGlyphSetZ getGlyphOrderÚsortedÚsetrJr6r r:Úerrorr;r)Újoin)rKrLrCZ ignoreErrorsrBrÚmodifiedrr)r0rr ¢s,  c CsŠddl}|dkr|jdd…}t|ƒdkrs:       ';