L i|!ddlmZddlmZefdZGddeZd dZedk(r`ddl Z e e jd k(r/ddl Z e je jje jeyy) )Callable)BasePenc8djfd|DS)N c3.K|] }|ywN).0intoss _/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/fontTools/pens/svgPathPen.py z pointToString..s(DG(s)join)ptr s `r pointToStringrs 88(R( ((c\eZdZdZefdeegeffdZdZdZ dZ dZ dZ d Z d Zd Zy ) SVGPathPenaPen to draw SVG path d commands. Args: glyphSet: a dictionary of drawable glyph objects keyed by name used to resolve component references in composite glyphs. ntos: a callable that takes a number and returns a string, to customize how numbers are formatted (default: str). :Example: .. code-block:: >>> pen = SVGPathPen(None) >>> pen.moveTo((0, 0)) >>> pen.lineTo((1, 1)) >>> pen.curveTo((2, 2), (3, 3), (4, 4)) >>> pen.closePath() >>> pen.getCommands() 'M0 0 1 1C2 2 3 3 4 4Z' Note: Fonts have a coordinate system where Y grows up, whereas in SVG, Y grows down. As such, rendering path data from this pen in SVG typically results in upside-down glyphs. You can fix this by wrapping the data from this pen in an SVG group element with transform, or wrap this pen in a transform pen. For example: .. code-block:: python spen = svgPathPen.SVGPathPen(glyphset) pen= TransformPen(spen , (1, 0, 0, -1, 0, 0)) glyphset[glyphname].draw(pen) print(tpen.getCommands()) r cvtj||g|_d|_d|_d|_||_yr)r__init__ _commands _lastCommand_lastX_lastY_ntos)selfglyphSetr s r rzSVGPathPen.__init__+s6x(    rcZ|jdk(r|jjdyy)z >>> pen = SVGPathPen(None) >>> pen.moveTo((0, 0)) >>> pen.moveTo((10, 10)) >>> pen._commands ['M10 10'] MN)rrpoprs r _handleAnchorzSVGPathPen._handleAnchor3s)    # NN  r " $rc|jdt||jz}|jj |d|_|\|_|_y)aV >>> pen = SVGPathPen(None) >>> pen.moveTo((0, 0)) >>> pen._commands ['M0 0'] >>> pen = SVGPathPen(None) >>> pen.moveTo((10, 0)) >>> pen._commands ['M10 0'] >>> pen = SVGPathPen(None) >>> pen.moveTo((0, 10)) >>> pen._commands ['M0 10'] zM%srN)r#rrrappendrrr)rrts r _moveTozSVGPathPen._moveTo>sM"  ]2tzz2 3 a #%  T[rc|\}}||jk(r||jk(ry||jk(rd}|j|}nf||jk(rd}|j|}nC|jdk(rd}dt ||jz}nd}t ||j}d}|r ||z }||_||z }|j j ||\|_|_y)aU # duplicate point >>> pen = SVGPathPen(None) >>> pen.moveTo((10, 10)) >>> pen.lineTo((10, 10)) >>> pen._commands ['M10 10'] # vertical line >>> pen = SVGPathPen(None) >>> pen.moveTo((10, 10)) >>> pen.lineTo((10, 0)) >>> pen._commands ['M10 10', 'V0'] # horizontal line >>> pen = SVGPathPen(None) >>> pen.moveTo((10, 10)) >>> pen.lineTo((0, 10)) >>> pen._commands ['M10 10', 'H0'] # basic >>> pen = SVGPathPen(None) >>> pen.lineTo((70, 80)) >>> pen._commands ['L70 80'] # basic following a moveto >>> pen = SVGPathPen(None) >>> pen.moveTo((0, 0)) >>> pen.lineTo((10, 10)) >>> pen._commands ['M0 0', ' 10 10'] NVHrrL)rrrrrrr%)rrxycmdptsr&s r _lineTozSVGPathPen._lineToUsH1  T[[ 0  $++ C**Q-C $++ C**Q-C   # %C b$**55CCDJJ/C   HA #D  S a #%  T[rc d}|t||jdzz }|t||jdzz }|t||jz }|jj|d|_|\|_|_y)z >>> pen = SVGPathPen(None) >>> pen.curveTo((10, 20), (30, 40), (50, 60)) >>> pen._commands ['C10 20 30 40 50 60'] CrNrrrr%rrr)rpt1pt2pt3r&s r _curveToOnezSVGPathPen._curveToOnesz  ]3 +c 11 ]3 +c 11 ]3 ++ a #&  T[rc|Jd}|t||jdzz }|t||jz }|jj|d|_|\|_|_y)aw >>> pen = SVGPathPen(None) >>> pen.qCurveTo((10, 20), (30, 40)) >>> pen._commands ['Q10 20 30 40'] >>> from fontTools.misc.roundTools import otRound >>> pen = SVGPathPen(None, ntos=lambda v: str(otRound(v))) >>> pen.qCurveTo((3, 3), (7, 5), (11, 4)) >>> pen._commands ['Q3 3 5 4', 'Q7 5 11 4'] NQrr4)rr5r6r&s r _qCurveToOnezSVGPathPen._qCurveToOnesj  ]3 +c 11 ]3 ++ a #&  T[rcd|jjdd|_dx|_|_y)zp >>> pen = SVGPathPen(None) >>> pen.closePath() >>> pen._commands ['Z'] ZN)rr%rrrr"s r _closePathzSVGPathPen._closePaths, c"$(( dkrc.d|_dx|_|_y)zk >>> pen = SVGPathPen(None) >>> pen.endPath() >>> pen._commands [] N)rrrr"s r _endPathzSVGPathPen._endPaths!$(( dkrc8dj|jS)Nr,)rrr"s r getCommandszSVGPathPen.getCommandsswwt~~&&rN)__name__ __module__ __qualname____doc__strrfloatrr#r'r1r8r;r>r@rBr rr rr sPBADx '= #&.@&D ''( ))'rrNc|ddl}|jdd}ddlm}ddl}|j dd}|j dd d |j d d d d|j ddd |j ddtd|j dddd|j|}|jt|jnd}||j|}|j}|j} i} |jjD]9} | jd} | dj!} t#| d}|| | <;|d}|j$|j&}}|j)| }|d j+| | t-d!| d"j/fd#|D} | j} d}d}| D]M}||}t1|}|j3||j5}|d$|||fzz }||j6z }Ot9d%t9d&|||z fzt9|d't9d(y))z-Generate per-character SVG from font and textNr)TTFontzfonttools pens.svgPathPenzGenerate SVG from text) descriptionfontzfont.ttfz Font file.)metavarhelptext?z Text string.)rNnargsrOz-yzz1Face index into a collection to open. Zero based.z--glyphsz(whitespace-separated list of glyph namesz*Glyphs to show. Exclusive with text option)rNtyperOz --variationszAXIS=LOCr,zList of space separated locations. A location consist in the name of a variation axis, followed by '=' and a number. E.g.: wght=700 wdth=80. The default is the location of the base master.)rNdefaultrO) fontNumber=hhea)locationcmapz)Options --glyphs and --text are exclusiverc3:K|]}t|ywr)ord)r urYs r rzmain..s51$s1v,5sz? z&z?)endz)sysargvfontTools.ttLibrKargparseArgumentParser add_argumentrG parse_argsr.intrMrPglyphs variationssplitstriprHascentdescent getGlyphSet getBestCmap ValueErrorrrdrawrBwidthprint)argsr^rKraparseroptionsrUrMrPrfrXtag_vfieldstagvrWrjrkglyphsetsrpgglyphpencommandsrYs @r mainrs |xx|&  $ $#1I%F  F cO   @  :  9   L %G#*99#8WYYaJ ',,: 6D <rs}*)G'G'TXv z 388}"))* CHHTVr