403Webshell
Server IP : 202.61.199.114  /  Your IP : 216.73.217.139
Web Server : nginx/1.22.1
System : Linux de.arni-solutions.de 6.1.0-49-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.174-1 (2026-05-26) x86_64
User : web20 ( 1018)
PHP Version : 8.4.23
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/local/lib/python3.9/dist-packages/matplotlib/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/local/lib/python3.9/dist-packages/matplotlib/__pycache__/textpath.cpython-39.pyc
a

���h�3�@s�ddlmZddlZddlZddlZddlmZm	Z	ddl
mZmZm
ZddlmZmZddlmZddlmZddlmZdd	lmZe�e�ZGd
d�d�Ze�ZGdd
�d
e�ZdS)�)�OrderedDictN)�
_text_helpers�dviread)�FontProperties�get_font�fontManager)�LOAD_NO_HINTING�LOAD_TARGET_LIGHT)�MathTextParser)�Path)�
TexManager)�Affine2Dc@steZdZdZdZdZdd�Zdd�Zdd	�Zd
d�Z	dd
�Z
ddd�Zddd�Zddd�Z
ddd�Zedd��ZdS)�
TextToPathz'A class that converts strings to paths.gY@�HcCstd�|_d|_dS)N�path)r
�mathtext_parserZ_texmanager��self�r�=/usr/local/lib/python3.9/dist-packages/matplotlib/textpath.py�__init__s
zTextToPath.__init__cCs&t�|�}t|�}|�|j|j�|S)zX
        Find the `FT2Font` matching font properties *prop*, with its size set.
        )�_fontManagerZ_find_fonts_by_propsr�set_size�
FONT_SCALE�DPI)r�prop�	filenames�fontrrr�	_get_fonts
zTextToPath._get_fontcCstS)N)rrrrr�_get_hinting_flag'szTextToPath._get_hinting_flagcCstj�|j�d|d���S)zO
        Return a unique id for the given font and character-code set.
        �-�x)�urllib�parse�quoteZpostscript_name)rr�ccoderrr�_get_char_id*szTextToPath._get_char_idcCs�|��}|dkrt��||�S||j}|rn|��}|�|j�|j�|d|�^}}}}	||||||fS|�|�}
|
j	|dt
d�|
��\}}|d}|d}|
��}
|
d}
|||||
|fS)N�TeXrg��flagsgP@)
�get_size_in_pointsr�get_text_width_height_descentr�copyrrr#rZset_textrZget_width_heightZget_descent)r�sr�ismath�fontsize�scale�width�height�descent�_r�w�h�drrrr+0s$
�

z(TextToPath.get_text_width_height_descentFcCs�|dkr|�||�\}}}n4|s>|�|�}|�||�\}}}n|�||�\}}}gg}}	|D]8\}
}}}
||
\}}|�||
||g�|	�|�q^|D]\}}|�|�|	�|�q�|s�t�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.
        r')r�)�get_glyphs_texr�get_glyphs_with_font�get_glyphs_mathtext�extend�np�empty)rrr-r.Z
glyph_info�	glyph_map�rectsrZverts�codesZglyph_idZ	xpositionZ	ypositionr0Zverts1Zcodes1rrr�
get_text_pathHs"$



zTextToPath.get_text_pathNc
Cs�|durt�}|rt�}n|}g}g}t�||�D]D}|�|jt|j��}	|�|	�|�|j�|	|vr2|j�	�||	<q2dgt
|�}
dgt
|�}g}tt|||
|��||fS)zW
        Convert string *s* to vertices and codes using the provided ttf font.
        Nrg�?)
rrZlayoutr&Z	ft_object�ord�char�appendr!�get_path�len�list�zip)
rrr-r?�return_new_glyphs_only�
glyph_map_new�
xpositions�	glyph_ids�item�char_id�
ypositions�sizesr@rrrr:�s&
�zTextToPath.get_glyphs_with_fontcCsr|��}|�|j�|j�||j|�\}}}}}	|s:t�}|rFt�}
n|}
g}g}g}
g}|D]�\}}}}}|�||�}||vr�|��|�|j|j�|j	|t
d�|��|
|<|�|�|�|�|
�|�||j}|�|�q^g}|	D]j\}}}}||f|||f||||f|||f||fdg}t
jt
jt
jt
jt
jt
jg}|�||f�q�tt|
|||��|
|fS)zW
        Parse mathtext string *s* and convert it to a (vertices, codes) pair.
        r(�rr)r,rrrr#rrr&�clear�	load_charrrFrEr�MOVETO�LINETO�	CLOSEPOLYrHrI)rrr-r?rJr1r2r3Zglyphsr@rKrLrPrMrQrr/r%�ox�oyrO�size�myrectsr5r6�vert1�code1rrrr;�sN�



���zTextToPath.get_glyphs_mathtextcCs�t��||j�}t�||j��}|\}Wd�n1s:0Y|durRt�}|r^t�}n|}ggggf\}	}
}}|jD]�}
t|
j	�}|�
||
j�}||v�r$|��|�
|j|j�|
j}t|t�r�|�|�}|j|td�n4t|t��r
|�|�|j|td�ntd|����|��||<|	�|�|
�|
j�|�|
j�|�|
j|j�q|g}|jD]l\}}}}||f|||f||||f|||f||fdg}tjtj tj tj tj tj!g}|�||f��qdt"t#|	|
||��||fS)z?Convert the string *s* to vertices and codes using usetex mode.Nr(zGlyph spec of unexpected type: rR)$rZmake_dvirrZDvirr�textrZ	font_pathr&ZglyphrSr�glyph_name_or_index�
isinstance�strZget_name_indexZ
load_glyphr	�int�_select_native_charmaprT�	TypeErrorrFrEr!�yZ	font_sizeZboxesrrUrVrWrHrI)rrr-r?rJZdvifileZdvi�pagerKrMrLrPrQr^rrOr_�indexr[rXrYr6r5r\r]rrrr9�sZ$





��
���zTextToPath.get_glyphs_texc
CsFdD].}z|�|�Wnttfy,Yq0qBqt�d|j�dS)N)iCBDAiBODAz#No supported encoding in font (%s).)Zselect_charmap�
ValueError�RuntimeError�_log�warning�fname)rZcharmap_coderrrrcsz!TextToPath._select_native_charmap)F)NF)NF)NF)�__name__�
__module__�__qualname__�__doc__rrrrrr&r+rBr:r;r9�staticmethodrcrrrrrs(	
<�
�
3�
:rcsReZdZdZd�fdd�	Zdd�Zd	d
�Zedd��Zed
d��Z	dd�Z
�ZS)�TextPathz&
    Create a path from the text.
    N�Fc	szddlm}t�|�}|dur&|��}||_|�|�d|_||d��|�\}}t	�j
tj|||d�|dd��d|_
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<customizing-with-dynamic-rc-settings>`.

        _interpolation_steps : int, optional
            (Currently ignored)

        usetex : bool, default: False
            Whether to use tex rendering.

        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.text 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)�TextN)�usetex)r.T)�_interpolation_steps�readonlyF)Zmatplotlib.textrtrZ	_from_anyr*�_xyr�_cached_verticesZ_preprocess_math�superr�text_to_pathrBZ_should_simplify)	rZxyr-rZrrvrurtr.��	__class__rrr*s-

�zTextPath.__init__cCs||_d|_dS)zSet the text size.TN)�_size�_invalid)rrZrrrrhszTextPath.set_sizecCs|jS)zGet the text size.)r~rrrr�get_sizemszTextPath.get_sizecCs|��|jS)zH
        Return the cached path after updating it if necessary.
        )�_revalidate_pathryrrrr�verticesqszTextPath.verticescCs|jS)z"
        Return the codes
        )�_codesrrrrrAyszTextPath.codescCsN|js|jdurJt��|jtj�j|j�}|�	|j
�|_d|jj_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)
rryr
r0r~r{r�	translaterxZ	transform�	_verticesr)Z	writeable)r�trrrrr��s
��
zTextPath._revalidate_path)NNrsF)rmrnrorprrr��propertyr�rAr��
__classcell__rrr|rrr%s�>

rr) �collectionsr�logging�urllib.parser"�numpyr=Z
matplotlibrrZmatplotlib.font_managerrrrrZmatplotlib.ft2fontrr	Zmatplotlib.mathtextr
Zmatplotlib.pathrZmatplotlib.texmanagerrZmatplotlib.transformsr
�	getLoggerrmrjrr{rrrrrr�<module>s 


Youez - 2016 - github.com/yon3zu
LinuXploit