403Webshell
Server IP : 35.80.110.71  /  Your IP : 216.73.216.221
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux ip-172-31-21-44 6.17.0-1019-aws #19~24.04.1-Ubuntu SMP Tue Jun 23 18:53:06 UTC 2026 x86_64
User : ubuntu ( 1000)
PHP Version : 8.3.31
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /usr/lib/python3/dist-packages/matplotlib/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3/dist-packages/matplotlib/__pycache__/mathtext.cpython-312.pyc
�

G8�c�#����dZddlmZddlZddlZddlZddlZddlm	Z	m
Z
ddlmZm
Z
ddlmZddl
mZmZmZej&e�Zee_e	j.d	�Gd
�d��Ze	j.d	�Gd�d
e��Ze	j.d	�Gd�de��Ze	j.d	�Gd�de��ZGd�d�Zddd�d�Zy)a0
A module for parsing a subset of the TeX math syntax and rendering it to a
Matplotlib backend.

For a tutorial of its usage, see :doc:`/tutorials/text/mathtext`.  This
document is primarily concerned with implementation details.

The module uses pyparsing_ to parse the TeX expression.

.. _pyparsing: https://pypi.org/project/pyparsing/

The Bakoma distribution of the TeX Computer Modern fonts, and STIX
fonts are supported.  There is experimental support for using
arbitrary fonts, but results may vary without proper tweaking and
metrics for those fonts.
�)�
namedtupleN)�_api�	_mathtext)�FT2Image�LOAD_NO_HINTING)�FontProperties�)�RasterParse�VectorParse�get_unicode_indexz3.6c�4�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	y)	�MathtextBackenda�
    The base class for the mathtext backend-specific code.  `MathtextBackend`
    subclasses interface between mathtext and specific Matplotlib graphics
    backends.

    Subclasses need to override the following:

    - :meth:`render_glyph`
    - :meth:`render_rect_filled`
    - :meth:`get_results`

    And optionally, if you need to use a FreeType hinting style:

    - :meth:`get_hinting_type`
    c�.�d|_d|_d|_y)Nr��width�height�depth��selfs �5/usr/lib/python3/dist-packages/matplotlib/mathtext.py�__init__zMathtextBackend.__init__6s����
������
�c�.�||_||_||_y)z(Set the dimension of the drawing canvas.Nr)r�w�h�ds    r�set_canvas_sizezMathtextBackend.set_canvas_size;s����
������
rc��t��)z_
        Draw a glyph described by *info* to the reference point (*ox*,
        *oy*).
        ��NotImplementedError�r�ox�oy�infos    r�render_glyphzMathtextBackend.render_glyphA�
��
"�#�#rc��t��)zR
        Draw a filled black rectangle from (*x1*, *y1*) to (*x2*, *y2*).
        r�r�x1�y1�x2�y2s     r�render_rect_filledz"MathtextBackend.render_rect_filledHs
��"�#�#rc��t��)zp
        Return a backend-specific tuple to return to the backend after
        all processing is done.
        r�r�boxs  r�get_resultszMathtextBackend.get_resultsNr&rc��tS)z\
        Get the FreeType hinting type to use with this particular
        backend.
        )rrs r�get_hinting_typez MathtextBackend.get_hinting_typeUs
��
�rN)
�__name__�
__module__�__qualname__�__doc__rrr%r-r1r3�rrrr%s%����
�$�$�$�rrc�J��eZdZdZ�fd�Zd�Z�fd�Zd�Zd�Zd�Z	d�Z
�xZS)	�MathtextBackendAggz�
    Render glyphs and rectangles to an FTImage buffer, which is later
    transferred to the Agg image by the Agg backend.
    c�l��d|_d|_d|_d|_gd�|_t
�|��y)Nr�bbox)rrrr)r"r#�image�moder<�superr�r�	__class__s �rrzMathtextBackendAgg.__init__cs1�����������
���	� ��	�
���rc���t|jd|�t|jd|�t|jd|�t|jd|�g|_y)Nrr	��)�minr<�maxr(s     r�_update_bboxzMathtextBackendAgg._update_bboxksS������1��r�*�����1��r�*�����1��r�*�����1��r�*�,��	rc
����t�|�|||�|jdk7rEtt	j
|�t	j
|t
|d�z��|_yy)Nr<r)r?rr>r�np�ceilrFr=)rrrrrAs    �rrz"MathtextBackendAgg.set_canvas_sizeqsN���
����1�a�(��9�9���!�"�'�'�!�*�b�g�g�a�#�a��)�m�.D�E�D�J�rc��|jdk(rq|j||jjz||jjz
||jj
z||jjz
�y|jj|j|||jjz
|jtjd��y)Nr<ztext.antialiased)�antialiased)r>rG�metrics�xmin�ymax�xmax�ymin�font�draw_glyph_to_bitmapr=�iceberg�glyph�mpl�rcParamsr!s    rr%zMathtextBackendAgg.render_glyphvs����9�9������b�4�<�<�#4�#4�4� �4�<�<�#4�#4�4� �4�<�<�#4�#4�4� �4�<�<�#4�#4�4�
6�

�I�I�*�*��
�
�B��T�\�\�%9�%9� 9�4�:�:��L�L�);�<�
+�
>rc�V�|jdk(r|j||||�ytt||z
�dz
d�}|dk(r||zdz}t||dzdzz
�}nt|�}|jjt|�|t
j|�||z�y)Nr<r	rg@)r>rGrF�intr=�draw_rect_filledrIrJ)rr)r*r+r,r�center�ys        rr-z%MathtextBackendAgg.render_rect_filled�s����9�9������b�"�b�"�-���R�"�W���)�1�-�F���{��r�'�S�����&�1�*��!3�3�4����G���J�J�'�'��B���B�G�G�B�K��V��Lrc�d�d|_d|_tj|�j	�S)N�render)r=r>r�ship�	to_rasterr/s  rr1zMathtextBackendAgg.get_results�s(����
���	��~�~�c�"�,�,�.�.rc�.�ddlm}|j�S)Nr��backend_agg)�matplotlib.backendsrc�get_hinting_flag)rrcs  rr3z#MathtextBackendAgg.get_hinting_type�s��3��+�+�-�-r)r4r5r6r7rrGrr%r-r1r3�
__classcell__�rAs@rr:r:]s-�����,�F�
	>�
M�/�
.rr:c�F��eZdZdZedd�Z�fd�Zd�Zd�Zd�Z	�xZ
S)�MathtextBackendPathzY
    Store information to write a mathtext rendering to the text path
    machinery.
    �_Resultzwidth height depth glyphs rectsc�>��t�|��g|_g|_y�N)r?r�glyphs�rectsr@s �rrzMathtextBackendPath.__init__�s���
���������
rc��|j|z
|jz}|jj|j|j
|j||f�yrl)r�offsetrm�appendrR�fontsize�numr!s    rr%z MathtextBackendPath.render_glyph�sB��
�[�[�2�
����
+�������D�I�I�t�}�}�d�h�h��B�G�Hrc�h�|jj||j|z
||z
||z
f�yrl)rnrqrr(s     rr-z&MathtextBackendPath.render_rect_filled�s.���
�
���2�t�{�{�R�/��b��"�r�'�B�Crc�H�tj|�j�Srl)rr_�	to_vectorr/s  rr1zMathtextBackendPath.get_results�s���~�~�c�"�,�,�.�.r)r4r5r6r7rrjrr%r-r1rfrgs@rriri�s-����
��$E�F�G��
I�D�/rric��eZdZy)�MathTextWarningN)r4r5r6r8rrrxrx�s��rrxc���eZdZdZej
ejejejejejd�Zd�Zdd�Z
ejd�d��Zy)�MathTextParserN)�cm�dejavuserif�
dejavusans�stix�stixsans�customc�`�tjdddd�|j���|_y)a	
        Create a MathTextParser for the given backend *output*.

        Parameters
        ----------
        output : {"path", "agg"}
            Whether to return a `VectorParse` ("path") or a
            `RasterParse` ("agg", or its synonym "macosx").
        �vector�raster)�path�agg�macosx)�outputN)r�
check_getitem�lower�_output_type)rr�s  rrzMathTextParser.__init__�s*��!�.�.��h�(�C��<�<�>�#��rc�P�|�|j�nd}|j|||�S)a�
        Parse the given math expression *s* at the given *dpi*.  If *prop* is
        provided, it is a `.FontProperties` object specifying the "default"
        font to use in the math expression, used for all non-math text.

        The results are cached, so multiple calls to `parse`
        with the same expression should be fast.

        Depending on the *output* type, this returns either a `VectorParse` or
        a `RasterParse`.
        N)�copy�
_parse_cached)r�s�dpi�props    r�parsezMathTextParser.parse�s+��#�.�t�y�y�{�D���!�!�!�S�$�/�/r�2c�@�ddlm}|�
t�}tj|j
|j
���}t|j�d�|j}|||�}|j�}|j�#tj�|j_|jj||||�}	tj |	�}
|jdk(r|
j#�S|jdk(r|
j%�Sy)Nrrb)�fontset)r�r�r�r�)rdrcrrr��_font_type_mapping�get_math_fontfamilyrrer��get_size_in_points�_parserr�ParserrAr�r_rvr`)rr�r�r�rc�
fontset_class�load_glyph_flagsr�rrr0r�s           rr�zMathTextParser._parse_cached�s��3��<�!�#�D��*�*��#�#�T�-E�-E�-G�I�
�&�!�2�2�4�
��
�
��� ��&6�7���*�*�,���<�<��%.�%5�%5�%7�D�N�N�"��l�l� � ��G�X�s�;������$������(��#�#�%�%�
�
�
�(�
*��#�#�%�%�+r)�HN)r4r5r6r�r�BakomaFonts�DejaVuSerifFonts�DejaVuSansFonts�	StixFonts�
StixSansFonts�UnicodeFontsr�rr��	functools�	lru_cacher�r8rrrzrz�sp���G� �,�,� �1�1� �0�0� �*�*� �.�.� �-�-�
��#�0�$�Y�����&��&rrz)�colorc���ddlm}td�}|j|d|��\}}	}
}}|j	|dz|	dzf��}|jd|
|	z|||��|j
|||�	�|
S)
a�
    Given a math expression, renders it in a closely-clipped bounding
    box to an image file.

    Parameters
    ----------
    s : str
        A math expression.  The math portion must be enclosed in dollar signs.
    filename_or_obj : str or path-like or file-like
        Where to write the image data.
    prop : `.FontProperties`, optional
        The size and style of the text.
    dpi : float, optional
        The output dpi.  If not set, the dpi is determined as for
        `.Figure.savefig`.
    format : str, optional
        The output format, e.g., 'svg', 'pdf', 'ps' or 'png'.  If not set, the
        format is determined as for `.Figure.savefig`.
    color : str, optional
        Foreground color, defaults to :rc:`text.color`.
    r)�figurer�r�)r�r�gR@)�figsize)�fontpropertiesr�)r��format)�
matplotlibr�rzr��Figure�text�savefig)
r��filename_or_objr�r�r�r�r��parserrrr�_�figs
             r�
math_to_imager��s~��."�
�F�
#�F�!'���a�R�d��!C��E�6�5�!�Q�
�-�-����v��}� =�-�
>�C��H�H�Q��f��a��E�H�B��K�K��S��K�8��Lr)NNN)r7�collectionsrr��logging�numpyrIr�rVrr�matplotlib.ft2fontrr�matplotlib.font_managerrr
rr�	getLoggerr4�_logr5�
deprecatedrr:ri�Warningrxrzr�r8rr�<module>r�s����"#�����&�8�2�1�1��w����"�� (���������4�4��4�n������6.��6.��6.�r������/�/�/��/�0������	�g�	��	�C&�C&�L �� r

Youez - 2016 - github.com/yon3zu
LinuXploit