Files
old-parkingkoncept/parkingkonceptvenv/lib/python3.7/site-packages/matplotlib/__pycache__/textpath.cpython-37.pyc

207 lines
14 KiB
Plaintext
Raw Normal View History

2019-11-17 12:44:16 +01:00
B
U<>] F<00>@s<>ddlmZddlZddlZddlZddlZddlm Z m
Z
m Z m Z ddl mZmZddlmZmZmZddlmZddlmZddlmZe<03>e<1B>ZGd d
<EFBFBD>d
e<1D>Ze<1E>ZGd d <0C>d e<17>Z dS) <0A>)<01> OrderedDictN)<04>cbook<6F>dviread<61> font_manager<65>rcParams)<02>FontProperties<65>get_font)<03>KERNING_DEFAULT<4C>LOAD_NO_HINTING<4E>LOAD_TARGET_LIGHT)<01>MathTextParser)<01>Path)<01>Affine2Dc@s<>eZdZdZdZdZdd<05>Zee<08> d<06>dd<08><00><01>Z
d d
<EFBFBD>Z d d <0C>Z d d<0E>Z dd<10>Zej ddd<13>d)dd<16><01>Zdd<18>Ze<08>dd<19>d*dd<1C><01>Zd+dd<1F>Zd,d d!<21>Zd"d#<23>Zd-d$d%<25>Zee<18>d&<26>d'd(<28><00><01>ZdS).<2E>
TextToPathz'A class that converts strings to paths.gY@<40>HcCstd<01>|_d|_dS)N<>path)r <00>mathtext_parser<65> _texmanager)<01>self<6C>r<00>;/tmp/pip-install-i8dhxrtk/matplotlib/matplotlib/textpath.py<70>__init__s
zTextToPath.__init__z3.0cCst<00>t<00>d<01><01>S)Nz
pdftex.map)r<00>
PsfontsMap<EFBFBD> find_tex_file)rrrr<00> tex_font_mapszTextToPath.tex_font_mapcCs&t<00>|<01>}t|<02>}|<03>|j|j<05>|S)zX
Find the `FT2Font` matching font properties *prop*, with its size set.
)rZfindfontr<00>set_size<7A>
FONT_SCALE<EFBFBD>DPI)r<00>prop<6F>fname<6D>fontrrr<00> _get_font"s
zTextToPath._get_fontcCstS)N)r
)rrrr<00>_get_hinting_flag+szTextToPath._get_hinting_flagcCstj<01>d<01>|j|<02><02>S)zO
Return a unique id for the given font and character-code set.
z{}-{})<05>urllib<69>parse<73>quote<74>formatZpostscript_name)rr <00>ccoderrr<00> _get_char_id.szTextToPath._get_char_idcCs$|<01><00>d}tj<02>d||f<00>}|S)zY
Return a unique id for the given font and character-code set (for tex).
<20>z%s-%d)Zget_ps_font_infor#r$r%)rr r'Zps_name<6D>char_idrrr<00>_get_char_id_ps4s zTextToPath._get_char_id_psz3.1z6font.get_path() and manual translation of the vertices)<01> alternative<76>cCs4|<01><00>\}}|dkr,|dd<02>df|7<||fS)z?Convert the *font*'s current glyph to a (vertices, codes) pair.gNr)<01>get_path)rr <00>currx<72>verts<74>codesrrr<00> glyph_to_path<s zTextToPath.glyph_to_pathcCs<>tdr8|<00><01>}|<02><02>}|j||dd<02>\}}}|||fS|<02><02>}||j} |r<>|<02><05>}|<02>|j<04>|j<07>|d|<02>\}
} } } }|
| | | | | fS|<00> |<02>}|j
|dt d<05>|<0F> <0C>\}}|d}|d}|<0F> <0A>}|d}|| || || fS)Nz text.usetex)Zrendererrg)<01>flagsgP@)r<00>get_texmanager<65>get_size_in_points<74>get_text_width_height_descentr<00>copyrrr$r!Zset_textr
Zget_width_heightZ get_descent)r<00>sr<00>ismathZ
texmanager<EFBFBD>fontsize<7A>w<>h<>d<>scale<6C>width<74>height<68>descentZtrashZused_charactersr rrrr6Fs*

 
 z(TextToPath.get_text_width_height_descent<6E>usetexFcCs<>|rd}|dkr$|<00>||<02>\}}}n4|sF|<00>|<01>}|<00>||<02>\}}}n|<00>||<02>\}}}gg} }
xR|D]J\} } } }|| \}}t|<0F>rht<05>|<0F>|| | g}| <09>|<0F>|
<EFBFBD>|<10>qhWx$|D]\}}| <09>|<0F>|
<EFBFBD>|<10>q<>W| |
fS)a*
Convert text *s* to path (a tuple of vertices and codes for
matplotlib.path.Path).
Parameters
----------
prop : `matplotlib.font_manager.FontProperties` instance
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 renderering.
usetex : bool, optional
If set, forces *ismath* to True. This parameter is deprecated.
Returns
-------
verts, codes : tuple of lists
*verts* is a list of numpy arrays containing the x and y
coordinates of the vertices. *codes* is 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.textpath import TextToPath
from matplotlib.font_manager import FontProperties
fp = FontProperties(family="Humor Sans", 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.
<20>TeX)<08>get_glyphs_texr!<00>get_glyphs_with_font<6E>get_glyphs_mathtext<78>len<65>np<6E>array<61>extend)rrr8r9rBZ
glyph_info<EFBFBD> glyph_map<61>rectsr r0r1Zglyph_idZ xpositionZ ypositionr>Zverts1Zcodes1rrr<00> get_text_pathbs&,

 

zTextToPath.get_text_pathNcCsd}d}g}g}|dkrt<00>}|r*t<00>} n|} x<>|D]<5D>}
t|
<EFBFBD>} |<01>| <0B>} | dkr^td<03>} d} |dk rv|<01>|| t<04>} nd} |j| td<04>}|jd}|<00>|| <0B>}||kr<>|<01> <09>| |<|| d7}|<07>
|<06>|<08>
|<10>||7}| }q4Wdgt |<07>}dgt |<07>}g}t t ||||<12><04>| |fS)zW
Convert string *s* to vertices and codes using the provided ttf font.
Nr<00>?)r3i<00>@g<00>?)r<00>ordZget_char_indexZ get_kerningr <00> load_charr
ZlinearHoriAdvancer(r.<00>appendrG<00>list<73>zip)rr r8rK<00>return_new_glyphs_onlyZlastgindr/<00>
xpositions<EFBFBD> glyph_ids<64> glyph_map_new<65>cr'Zgind<6E>kern<72>glyphZ horiz_advancer*<00>
ypositions<EFBFBD>sizesrLrrrrE<00>sB


   

zTextToPath.get_glyphs_with_fontcCsz|<01><00>}|<01>|j<02>|j<03>||j|<01>\}}}}} |s:t<06>}|rFt<06>}
n|}
g} g} g} g}x<>|D]<5D>\}}}}}|<00>||<11>}||kr<>|<0F><08>|<0F>|j|j<05>|j |t
d<01>}|<0F> <0B>|
|<| <0B> |<12>| <0C> |<13>| <0A> |<14>||j}|<0E> |<16>q`Wg}xr| D]j\}}}}||f|||f||||f|||f||fdg}t jt jt jt jt jt jg}|<17> ||f<02>q<>Wtt| | | |<0E><04>|
|fS)zW
Parse mathtext string *s* and convert it to a (vertices, codes) pair.
)r3)rr)r7rrrr$rrr(<00>clearrQr
r.rRr <00>MOVETO<54>LINETO<54> CLOSEPOLYrSrT)rrr8rKrUr?r@rAZglyphsrLrXrVr\rWr]r r:r'<00>ox<6F>oyr*r[<00>size<7A>myrectsr;r<<00>vert1<74>code1rrrrF<00>sF   



zTextToPath.get_glyphs_mathtextcCs$|jdkrddlm}|<01>|_|jS)z5Return the cached `~.texmanager.TexManager` instance.Nr)<01>
TexManager)rZmatplotlib.texmanagerrh)rrhrrrr4s
 zTextToPath.get_texmanagerc Cs<>|<00><00><00>||j<02>}t<03>||j<05><02> }|\}WdQRX|dkr@t<06>}|rLt<06>}n|}ggggf\} }
} } x<>|jD]<5D>\} }}}}|<00>|j <09>\}}|<00>
||<10>}||kr<>|<12> <0B>|<12> |j|j<05>|dk r<>|<12> ||<00>}|j|td<02>n|j|td<02>|<12><11>||<| <09>|<14>|
<EFBFBD>| <0A>| <0B>|<0E>| <0C>|j|j<00>qlWg}xv|jD]l\}}}}||f|||f||||f|||f||fdg}tjtjtjtjtjtjg}|<16>||f<02><00>q6Wtt| |
| | <0C><04>||fS)z?Convert the string *s* to vertices and codes using usetex mode.N)r3)rr)r4Zmake_dvirrZDvirr<00>text<78>_get_ps_font_and_encoding<6E>texnamer+r^rZget_name_indexZ
load_glyphr rQr.rRrdZboxesr r_r`rarSrT)rrr8rKrUZdvifileZdvi<76>pagerXrWrVr\r]<00>x1<78>y1Zdvifontr[r?r <00>encr*<00>indexrerbrcr<r;rfrgrrrrDsD  


zTextToPath.get_glyphs_tex<65>2c
Cs<>t<00>t<00>d<01><01>}||}|jdkr:td|j<05>d|<00>d<04><05><01>t|j<03>}|jrXt<00>|j<07>}nRxLdD]2\}}y|<03> |<06>Wntt
fk
r<EFBFBD>Yq^XPq^Wd}t <0B> d|j<03>d}||fS)Nz
pdftex.mapzNo usable font file found for z (z&). The font may lack a Type-1 version.))Z ADOBE_CUSTOMiCBDA)ZADOBE_STANDARDiBODA<44>z#No supported encoding in font (%s).) rrr<00>filename<6D>
ValueErrorZpsnamer<00>encodingZ
_parse_encZselect_charmap<61> RuntimeError<6F>_log<6F>warning)rkrZ
font_bunchr roZ charmap_nameZ charmap_coderrrrjSs&

z$TextToPath._get_ps_font_and_encoding)r-)FF)NF)NF)NF)<1B>__name__<5F>
__module__<EFBFBD> __qualname__<5F>__doc__rrr<00>propertyr<00>
deprecatedrr!r"r(r+r2r6Z_delete_parameterrMrErFr4rD<00> staticmethod<6F> functools<6C> lru_cacherjrrrrrs4  
 D
;
2
5rc@sreZdZdZddd<06>Zdd<08>Zd d
<EFBFBD>Zed d <0C><00>Zed d<0E><00>Z dd<10>Z
e <0B> d<11>dd<13><00>Z e j ddd<14>dd<16><00>ZdS)<18>TextPathz&
Create a path from the text.
N<>Fc Os<>ddlm} |s|r"tjddd<05>|dkr0t<04>}|dkr@|<04><05>}||_|<00>|<03>d|_| |d<07><01> |<02>\}}
t
j |||
d<08>\|_ |_ d |_td
|_||_dS) a 
Create a path from the text. Note that it simply is a path,
not an artist. You need to use the `~.PathPatch` (or other artists)
to draw this path onto the canvas.
Parameters
----------
xy : tuple or array of two float values
Position of the text. For no offset, use ``xy=(0, 0)``.
s : str
The text to convert to a path.
size : float, optional
Font size in points. Defaults to the size specified via the font
properties *prop*.
prop : `matplotlib.font_manager.FontProperties`, optional
Font property. If not provided, will use a default
``FontProperties`` with parameters from the
:ref:`rcParams <matplotlib-rcparams>`.
_interpolation_steps : integer, optional
(Currently ignored)
usetex : bool, optional
Whether to use tex rendering. Defaults to ``False``.
Examples
--------
The following creates a path from the string "ABC" with Helvetica
font face; and another path from the latex fraction 1/2::
from matplotlib.textpath import TextPath
from matplotlib.font_manager import FontProperties
fp = FontProperties(family="Helvetica", style="italic")
path1 = TextPath((12,12), "ABC", size=12, prop=fp)
path2 = TextPath((0,0), r"$\frac{1}{2}$", size=12, usetex=True)
Also see :doc:`/gallery/text_labels_and_annotations/demo_text_path`.
r)<01>Textz3.1z^Additional arguments to TextPath used to be ignored, but will trigger a TypeError %(removal)s.)<01>messageN)rB)r9Fzpath.simplify_threshold)Zmatplotlib.textr<74>rZwarn_deprecatedrr5<00>_xyr<00>_cached_verticesZ_preprocess_math<74> text_to_pathrM<00> _vertices<65>_codesZ_should_simplifyrZ_simplify_threshold<6C>_interpolation_steps) rZxyr8rdrr<>rB<00>args<67>kwargsr<73>r9rrrr<00>s"0 


zTextPath.__init__cCs||_d|_dS)zSet the text size.TN)<02>_size<7A>_invalid)rrdrrrr<00>szTextPath.set_sizecCs|jS)zGet the text size.)r<>)rrrr<00>get_size<7A>szTextPath.get_sizecCs|<00><00>|jS)zH
Return the cached path after updating it if necessary.
)<02>_revalidate_pathr<68>)rrrr<00>vertices<65>szTextPath.verticescCs|jS)z"
Return the codes
)r<>)rrrrr1<00>szTextPath.codescCsN|js|jdkrJt<02><00>|jtj|jtj<00>j|j<08>}|<01> |j
<EFBFBD>|_d|_dS)z<>
Update the path if necessary.
The path for the text is initially create with the font size of
`~.FONT_SCALE`, and this path is rescaled to other size when necessary.
NF) r<>r<>rr>r<>r<>r<00> translater<65>Z transformr<6D>)r<00>trrrrr<><00>s 
zTextPath._revalidate_pathz3.1cCsX|<01>d<01>|<01>d<02>}|dko&|ddk}tdr8|dfS|rD|dfS|<01>dd<01>dfSd S)
zM
Returns True if the given string *s* contains any mathtext.
<20>$z\$rr)z text.usetexrCTFN)<03>countr<00>replace)rr8Z dollar_countZ even_dollarsrrr<00> is_math_text<78>s zTextPath.is_math_text)r,cCs6|rtj||dd<02>S|<00>|<02>\}}tj|||d<03>SdS)zd
Convert string *s* to a (vertices, codes) pair using font property
*prop*.
T)rB)r9N)r<>rMr<>)rrr8rBZ
clean_liner9rrr<00>text_get_vertices_codes
sz TextPath.text_get_vertices_codes)NNr<4E>F)ryrzr{r|rrr<>r}r<>r1r<>rr~r<>r<>rrrrr<><00>s
F  r<>)!<21> collectionsrr<><00>logging<6E> urllib.parser#ZnumpyrHZ
matplotlibrrrrZmatplotlib.font_managerrrZmatplotlib.ft2fontr r
r Zmatplotlib.mathtextr Zmatplotlib.pathr Zmatplotlib.transformsr<00> getLoggerryrw<00>objectrr<>r<>rrrr<00><module>s    
p