Files
intellecton/venv/lib/python3.12/site-packages/matplotlib/__pycache__/textpath.cpython-312.pyc
T

162 lines
17 KiB
Plaintext
Raw Normal View History

Ë
†RjÆ3ãóä—ddlmZddlZddlZddlZddlmZm Z ddl
m Z m Z m
ZddlmZddlmZddlmZddlmZdd lmZej2e«ZGd
„d «Ze«ZGd „d
e«Zy)é)Ú OrderedDictN)Ú
_text_helpersÚdviread)ÚFontPropertiesÚget_fontÚ fontManager)Ú LoadFlags)ÚMathTextParser)ÚPath)Ú
TexManager)ÚAffine2Dcór—eZdZdZdZdZd„Zd„Zd„Zd„Z d„Z
dd „Z dd „Z dd „Z
dd
„Zed„«Zy
)Ú
TextToPathz'A class that converts strings to paths.gY@éHcó2—td«|_d|_y)NÚpath)r
Úmathtext_parserÚ _texmanager©Úselfs úV/home/antigravity/intellecton/venv/lib/python3.12/site-packages/matplotlib/textpath.pyÚ__init__zTextToPath.__init__s€Ü-¨fÓ5ˆÔ؈Õócó’—tj|«}t|«}|j|j|j
«|S)zX
Find the `FT2Font` matching font properties *prop*, with its size set.
)Ú _fontManagerÚ_find_fonts_by_propsrÚset_sizeÚ
FONT_SCALEÚDPI)rÚpropÚ filenamesÚfonts rÚ _get_fontzTextToPath._get_fonts9€ô!×5Ñ5°dÓ;ˆ ܘ Ó"ˆØ �
‰
�d—o‘o t§x¡xÔ0؈ rcó"—tjS)N)r Ú
NO_HINTINGrs rÚ_get_hinting_flagzTextToPath._get_hinting_flag's€Ü×#Ñ#Ð#rcó`—tjj|j›d|d›�«S)zO
Return a unique id for the given font and character-code set.
ú-Úx)ÚurllibÚparseÚquoteÚpostscript_name)rr"Úccodes rÚ _get_char_idzTextToPath._get_char_id*s-€ô�|‰|×!Ñ! T×%9Ñ%9Ð$:¸!¸EÀ!¸9Ð"EÓFÐFrcó—|j«}|dk(rt«j||«S||jz }|rZ|j «}|j |j«|j j|d|«^}}}} ||z||z||zfS|j|«}
|
j|dtj¬«|
j«\} } | dz} | dz} |
j«}
|
dz}
| |z| |z|
|zfS)NÚTeXrg©ÚflagsgP@)Úget_size_in_pointsr Úget_text_width_height_descentrÚcopyrrr+r#Úset_textr r%Úget_width_heightÚ get_descent)rÚsr ÚismathÚfontsizeÚscaleÚwidthÚheightÚdescentÚ_r"ÚwÚhÚds rr5z(TextToPath.get_text_width_height_descent0s€Ø×*Ñ*Ó,ˆà �UŠ?Ü“<×=Ñ=¸aÀÓJÐ Jà˜4Ÿ?™?Ñ*ˆá Ø—9‘9“;ˆDØ �M‰M˜$Ÿ/™/Ô *à×$Ñ$×*Ñ*¨1¨b°$Ó7ð
'ˆE�6˜7 Qà˜5‘= &¨5¡.°'¸E±/ÐAÐ Aà�~‰~˜dÓ#ˆØ �
‰
�a˜¤I×$8Ñ$8ˆ
Ô9Ø×$Ñ$Ó&‰ˆˆ1Ø ˆT‰ ˆØ ˆT‰ ˆØ × Ñ Ó ˆØ ˆT‰ ˆØ�5‰y˜!˜e™) Q¨¡YÐ.Ð.rcóÌ—|dk(r|j||«\}}}n@|s(|j|«}|j||«\}}}n|j||«\}}}gg} }|D]9\}
} } }
||
\}}|j ||
z| | gz«| j |«Œ;|D]'\}}|j |«| j |«Œ)|st j d«}|| fS)a‘
Convert text *s* to path (a tuple of vertices and codes for
matplotlib.path.Path).
Parameters
----------
prop : `~matplotlib.font_manager.FontProperties`
The font properties for the text.
s : str
The text to be converted.
ismath : {False, True, "TeX"}
If True, use mathtext parser. If "TeX", use tex for rendering.
Returns
-------
verts : list
A list of arrays containing the (x, y) coordinates of the vertices.
codes : list
A list of path codes.
Examples
--------
Create a list of vertices and codes from a text, and create a `.Path`
from those::
from matplotlib.path import Path
from matplotlib.text import TextToPath
from matplotlib.font_manager import FontProperties
fp = FontProperties(family="Comic Neue", style="italic")
verts, codes = TextToPath().get_text_path(fp, "ABC")
path = Path(verts, codes, closed=False)
Also see `TextPath` for a more direct way to create a path from a text.
r1)ré)Úget_glyphs_texr#Úget_glyphs_with_fontÚget_glyphs_mathtextÚextendÚnpÚempty)rr r:r;Ú
glyph_infoÚ glyph_mapÚrectsr"ÚvertsÚcodesÚglyph_idÚ xpositionÚ ypositionr=Úverts1Úcodes1s rÚ
get_text_pathzTextToPath.get_text_pathHs€ðH �UŠ?Ø+/×+>Ñ+>¸tÀQÓ+GÑ (ˆJ˜ ¡5ÙØ—>‘> $Ó'ˆDØ+/×+DÑ+DÀTÈ1Ó+MÑ (ˆJ˜ ¡5à+/×+CÑ+CÀDÈ!Ó+LÑ (ˆJ˜  5à˜2ˆuˆØ5?ò !Ñ 1ˆH�i ¨EØ& xÑ0‰NˆF�FØ �L‰L˜ %™¨9°iÐ*@Ñ@Ô AØ �L‰L˜Õ ð !ð$ò !‰NˆF�FØ �L‰L˜Ô Ø �L‰L˜Õ ð !ñ Ü—H‘H˜VÓ$ˆEà�eˆ|ÐrNcóä—|€
t«}|r t«}n|}g}g}tj||«D]}|j|jt |j ««} |j| «|j|j«| |vsŒc|jj«|| <Œ�dgt|«z}
dgt|«z} g} tt|||
| ««|| fS)zW
Convert string *s* to vertices and codes using the provided ttf font.
rgð?)
rrÚlayoutr/Ú ft_objectÚordÚcharÚappendr)Úget_pathÚlenÚlistÚzip)
rr"r:rNÚreturn_new_glyphs_onlyÚ
glyph_map_newÚ
xpositionsÚ glyph_idsÚitemÚchar_idÚ
ypositionsÚsizesrOs
rrHzTextToPath.get_glyphs_with_font„sî€ð Ð Ü#›
ˆIá !Ü'›M‰Mà%ˆMàˆ
؈ Ü!×(Ñ(¨¨DÓ1ò CˆDØ×'Ñ'¨¯©¼¸D¿I¹I»ÓGˆGØ × Ñ ˜WÔ %Ø × Ñ ˜dŸf™fÔ %ؘiÒ'Ø)-¯©×)@Ñ)@Ó)B�
˜gÒ&ð  Cð�Sœ3˜z›?Ñ*ˆ
Ø�”s˜:“Ñ&ˆàˆä”S˜ J°
¸EÓBÓCؘuð&ð &rcó"—|j«}|j|j«|jj ||j
|«\}}}}} |s
t
«}|r t
«}
n|}
g} g} g}
g}|D]Û\}}}}}|j||«}||vrj|j«|j|j|j
«|j|tj¬«|j«|
|<| j|«| j|«|
j|«||jz }|j|«ŒÝg}| D]”\}}}}||f|||zf||z||zf||z|f||fdg}tjtj tj tj tj tj"g}|j||f«Œ–t%t'|
| | |««|
|fS)zW
Parse mathtext string *s* and convert it to a (vertices, codes) pair.
r2©rr)r6rrrr+rrr/ÚclearÚ load_charr r%r^r]r ÚMOVETOÚLINETOÚ CLOSEPOLYr`ra)rr r:rNrbr>r?r@ÚglyphsrOrcrdrhrerir"r<r.ÚoxÚoyrgÚsizeÚmyrectsrBrCÚvert1Úcode1s rrIzTextToPath.get_glyphs_mathtext£só€ð �y‰y‹{ˆØ �
‰
�d—o‘oÔ&à04×0DÑ0D×0JÑ0JØ
ˆt�x‰x˜ó1Ñ-ˆˆv�w ¨ñÜ#›
ˆIá !Ü'›M‰Mà%ˆMàˆ
؈
؈ ؈à-3ò Ñ )ˆD�(˜E 2 rØ×'Ñ'¨¨eÓ4ˆGؘiÑ'Ø—
‘
” Ø—
‘
˜dŸo™o¨t¯x©xÔ8Ø—‘˜u¬I×,@Ñ,@�ÔAØ)-¯©«�
˜gÑ&à × Ñ ˜bÔ !Ø × Ñ ˜bÔ !Ø × Ñ ˜WÔ %ؘdŸo™oÑ-ˆDØ �L‰L˜Õ ð ðˆØ!ò +‰LˆB��A�qؘ"�X  B¨¡F˜|¨b°1©f°b¸1±fÐ-=ؘ1‘f˜b�\ B¨ 8¨Vð5ˆEä—[‘[Ü—[‘[¤$§+¡+¬t¯{©{¼D¿K¹KÜ—^‘^ð%ˆEð
�N‰N˜E 5˜>Õ *ð
 +ô”S˜ J°
¸EÓBÓCؘwð(ð (rcóÈ—t«j||j«}tj||j
«5}|\}ddd«|€
t
«}|r t
«}n|}ggggf\} }
} } jD�]�}
t|
j«}|j||
j«}||vré|j«|j|j|j
«|
j}t|t «r3|j#|«}|j%|t&j(¬«nQt|t*«r3|j-|«|j/|t&j(¬«nt1d|›�«‚|j3«||<| j5|«|
j5|
j6«| j5|
j8«| j5|
j:|jz «�Œ“g}|j<D]”\}}}}||f||z|f||z||zf|||zf||fdg}t>j@t>jBt>jBt>jBt>jBt>jDg}|j5||f«Œ–tGtI| |
| | ««||fS#1swY�Œ�xYw)z?Convert the string *s* to vertices and codes using usetex mode.Nr2zGlyph spec of unexpected type: rk)%r Úmake_dvirrÚDvirrÚtextrÚ font_pathr/ÚglyphrlrÚglyph_name_or_indexÚ
isinstanceÚstrÚget_name_indexÚ
load_glyphr Ú TARGET_LIGHTÚintÚ_select_native_charmaprmÚ TypeErrorr^r]r)ÚyÚ font_sizeÚboxesr rnrorpr`ra)rr r:rNrbÚdvifileÚdviÚpagercrerdrhrir{r"rgr~ÚindexrurrrsrCrBrvrws rrGzTextToPath.get_glyphs_texÖs�€ô
“,×'Ñ'¨¨4¯?©?Ó;ˆÜ
�[‰[˜ $§(¡(Ó
+ð ¨s؉EˆD÷ ð Ð Ü#›
ˆIá !Ü'›M‰Mà%ˆMà35°r¸2¸r°>Ñ0ˆ �:˜z¨5ð—I‘Ió ;ˆDܘDŸN™NÓ+ˆDØ×'Ñ'¨¨d¯j©jÓ9ˆGؘiÑ'Ø—
‘
” Ø—
‘
˜dŸo™o¨t¯x©xÔ8Ø&*×&>Ñ&>Ð#ÜÐ1´3Ô7Ø ×/Ñ/Ð0CÓD�EØ—O‘O E´×1GÑ1G�OÕHÜÐ 3´SÔ9Ø×/Ñ/°Ô5Ø—N‘NØ+´9×3IÑ3Ið#õKô$Ð&EØ':Ð&=ð%?ó@ð@à)-¯©«�
˜gÑ&à × Ñ ˜WÔ %Ø × Ñ ˜dŸf™fÔ %Ø × Ñ ˜dŸf™fÔ %Ø �L‰L˜Ÿ™¨$¯/©/Ñ9Ö :ð- ;ð0ˆà ŸJ™Jò +‰LˆB��A�qؘ"�X  Q¡¨˜|¨b°1©f°b¸1±fÐ-=ؘ"˜q™&�\ B¨ 8¨Vð5ˆEä—[‘[Ü—[‘[¤$§+¡+¬t¯{©{¼D¿K¹KÜ—^‘^ð%ˆEð
�N‰N˜E 5˜>Õ *ð
 +ô”S˜ J°
¸EÓBÓCؘwð(ð (÷c ñ ús ÁKËK!có¢—dD]} |j|«ytj d|j
«y#ttf$rYŒJwxYw)N)iCBDAiBODAz#No supported encoding in font (%s).)Úselect_charmapÚ
ValueErrorÚ RuntimeErrorÚ_logÚwarningÚfname)r"Ú charmap_codes rr…z!TextToPath._select_native_charmaps[€ð
ò LˆLð
Ø×#Ñ# LÔ1ñð Lô
�L‰LÐ>ÀÇ
Á
Õ Køô ¤ Ð-ò
Ùð
ús‡<¼AÁ
A)F)NF)Ú__name__Ú
__module__Ú __qualname__Ú__doc__rrrr#r&r/r5rWrHrIrGÚ staticmethodr…©rrrrsn„Ù1à€JØ
€Cò òò$òGò /ó0:ðx7;Ø49ó&ð>6:Ø38ó1(ðf15Ø.3ó8(ðtñLóñLrrcóZ‡—eZdZdZ dˆfd„ Zd„Zd„Zed„«Zed„«Z d„Z
ˆxZ S) ÚTextPathz&
Create a path from the text.