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

162 lines
16 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óreZdZdZdZdZdZdZdZdZ dZ
dd „Z dd Z dd Z
dd
Zed«Zy
)Ú
TextToPathz'A class that converts strings to paths.gY@éHcó2td«|_d|_y)path)r
Úmathtext_parserÚ _texmanager©Úselfs úV/home/antigravity/intellecton/venv/lib/python3.12/site-packages/matplotlib/textpath.pyÚ__init__zTextToPath.__init__sÜ-¨fÓÔØˆÕó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°dÓ;ˆ ܘ Ó"ˆØ
d—oo t§x¡xÔˆ rcó"tjS)N)r Ú
NO_HINTINGrs rÚ_get_hinting_flagzTextToPath._get_hinting_flag'sÜ×#rcó`tjj|jd|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Ó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)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"Úds rr5z(TextToPath.get_text_width_height_descent0sØ×à UŠ?Ü“<×=¸aÀÓ ˜4Ÿ?™?Ñá Ø—9‘9“;ˆDØ M‰M˜$Ÿ/™/Ô ×*¨1¨b°$Ó
'ˆE6˜7 ˜5= &¨5¡.°'¸E±/Ð ~‰~˜Ø
a˜¤I×$8Ñ$8ˆ
Ô×&‰ˆˆ1Ø ˆT‰ ˆØ ˆT‰ ˆØ × Ñ Ó ˆØ ˆT‰ ˆØ5‰y˜!˜e™) ¡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˜  ˜2ˆuˆØ5?ò 1ˆHi ¨EØ& 0‰NˆF L‰L˜ %™¨9°iÐ*@Ñ L‰L˜Õ ð !‰NˆF L‰L˜Ô Ø L‰L˜Õ ð Ü—H‘H˜VÓ$ˆ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„ð Ð Ü#›
ˆ 'M‰Mà%ˆˆ
؈ ܨDÓ Cˆ×¯©¼¸D¿I¹I»ÓGˆGØ × Ñ ˜WÔ × Ñ ˜dŸf™fÔ ˜iÒ'Ø)-¯©×)@Ñ)@Ó)B
˜  CðSœ3˜z*ˆ
Ø”s˜:“Ñàˆä”S˜ 
¸˜ &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£ð y‰y‹{ˆØ
d—o&à04×0DÑ0D×0JÑ0JØ
ˆtx‰x˜ó1шv¨ñÜ#›
ˆ 'M‰Mà%ˆˆ
؈
؈ ؈à-3ò Ñ )ˆD(˜E 2 ×¨eÓ4ˆ˜
Ø
˜dŸo™o¨t¯x©xÔ˜u¬I×,@Ñ,@ÔAØ)-¯©«
˜ × Ñ ˜bÔ × Ñ ˜bÔ × Ñ ˜WÔ ˜dŸo™oÑ-ˆDØ L‰L˜Õ ð ðˆØ +‰LˆBA˜"X  ¡F˜|¨b°1©f°b¸1±fÐ-=ؘ1f˜b\  8¨Vð5ˆ—[‘[Ü—[‘[¤$§+¡+¬t¯{©{¼D¿K¹KÜ—^‘^ð%ˆEð
N‰N˜E 5˜
”S˜ 
¸EÓ˜ (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÷ ð Ð Ü#›
ˆ 'M‰Mà%ˆMà35°r¸2¸r°>Ñ0ˆ :˜z¨5ð—I ;ˆDܘDŸN™NÓ+ˆ×¨d¯j©jÓ9ˆ˜
Ø
˜dŸo™o¨t¯x©xÔ8Ø&*×&>Ñ&>ÐÐ1´ ×/Ð0CÓD—OO E´×1GÑ1GÐ 3´SÔ×Ô—N‘NØ+´9×3IÑ3IðKô$Ð&EØ':Ð&=ð%?ó@ð@à)-¯©«
˜ × Ñ ˜WÔ × Ñ ˜dŸf™fÔ × Ñ ˜dŸf™fÔ L‰L˜Ÿ¨$¯/©/Ñ :ð- ;ð0ˆà ŸJ™Jò +‰LˆBA˜"X  ¨˜|¨b°1©f°b¸1±fÐ-=ؘ"˜q™&\  8¨Vð5ˆ—[‘[Ü—[‘[¤$§+¡+¬t¯{©{¼D¿K¹KÜ—^‘^ð%ˆEð
N‰N˜E 5˜
”S˜ 
¸EÓ˜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ô
L‰LÐÇ
Á
Õ Køô ¤ Ð
Ùð
ús<¼AÁ
A)F)NF)Ú__name__Ú
__module__Ú __qualname__Ú__doc__rrrr#r&r/r5rWrHrIrGÚ staticmethodr…©rrrrsnÙ€JØ
€Cò òòGò /ó0:ðx7;Ø49ó&ð>6:Ø38ó1(ðf15Ø.3ó8(ðtñLóñLrrcóZeZdZdZ dˆfd„ ZdZdZed«Zed«Z dZ
ˆxZ S) ÚTextPathz&
Create a path from the text.