Ë
    ¨ehð  ã                   ó°   — d Z ddlZddlZddlZddlmZmZ ddlmZ ddl	m
Z
 ddlmZmZmZ  ej                  e«      Zee_         G d„ d	«      Zddd
œd„Zy)a   
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 :ref:`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.
é    N)Ú_apiÚ	_mathtext)Ú	LoadFlags)ÚFontPropertiesé   )ÚRasterParseÚVectorParseÚget_unicode_indexc                   óÞ   — e Zd ZdZej
                  ej                  ej                  ej                  ej                  ej                  dœZd„ Zdddœd„Z ej                  d«      d„ «       Zy)	ÚMathTextParserN)ÚcmÚdejavuserifÚ
dejavusansÚstixÚstixsansÚcustomc                 ó`   — t        j                  ddddœ|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)Úselfr   s     úQ/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/matplotlib/mathtext.pyÚ__init__zMathTextParser.__init__0   s*   € ô !×.Ñ.Ø h¸(ÑCØ—<‘<“>ô#ˆÕó    ©Úantialiasedc                óè   — |�|j                  «       nd}t        j                  |d«      }ddlm} t
        j                  |j                  «       dœ| j                     }| 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`.
        Nztext.antialiasedr   )Úbackend_agg)r   r   )
ÚcopyÚmplÚ
_val_or_rcÚmatplotlib.backendsr$   r   Ú
NO_HINTINGÚget_hinting_flagr   Ú_parse_cached)r   ÚsÚdpiÚpropr"   r$   Úload_glyph_flagss          r   ÚparsezMathTextParser.parse>   ss   € ð" #Ð.ˆt�y‰yŒ{°DˆÜ—n‘n [Ð2DÓEˆÝ3ä×*Ñ*Ø!×2Ñ2Ó4ñ
ð ×
Ñ
ñÐð ×!Ñ! ! S¨$°Ð=MÓNÐNr    é2   c                 óð  — |€
t        «       }t        j                  | j                  |j	                  «       ¬«      } |||«      }|j                  «       }| j                  €#t        j                  «       | j                  _        | j                  j                  ||||«      }	t        j                  |	«      }
| j                  dk(  r|
j                  «       S | j                  dk(  r|
j                  |¬«      S y )N)Úfontsetr   r   r!   )r   r   r   Ú_font_type_mappingÚget_math_fontfamilyÚget_size_in_pointsÚ_parserr   ÚParserÚ	__class__r0   Úshipr   Ú	to_vectorÚ	to_raster)r   r,   r-   r.   r"   r/   Úfontset_classr3   ÚfontsizeÚboxr   s              r   r+   zMathTextParser._parse_cachedX   sÚ   € àˆ<Ü!Ó#ˆDÜ×*Ñ*Ø×#Ñ#¨T×-EÑ-EÓ-GôIˆá Ð&6Ó7ˆØ×*Ñ*Ó,ˆà�<‰<ÐÜ%.×%5Ñ%5Ó%7ˆD�N‰NÔ"à�l‰l× Ñ   G¨X°sÓ;ˆÜ—‘ Ó$ˆØ×Ñ Ò(Ø×#Ñ#Ó%Ð%Ø×Ñ (Ò*Ø×#Ñ#°Ð#Ó<Ð<ð +r    )éH   N)Ú__name__Ú
__module__Ú__qualname__r7   r   ÚBakomaFontsÚDejaVuSerifFontsÚDejaVuSansFontsÚ	StixFontsÚStixSansFontsÚUnicodeFontsr4   r   r0   Ú	functoolsÚ	lru_cacher+   © r    r   r   r   %   sy   „ Ø€Gà ×,Ñ,Ø ×1Ñ1Ø ×0Ñ0Ø ×*Ñ*Ø ×.Ñ.Ø ×-Ñ-ñÐò#ðO¸ô Oð4 €Y×Ñ˜Óñ=ó ñ=r    r   )Úcolorc                óê   — ddl m} t        d«      }|j                  | d|¬«      \  }}	}
}}|j	                  |dz  |	dz  f¬«      }|j                  d|
|	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.   g      R@)Úfigsize)ÚfontpropertiesrM   )r-   Úformat)Ú
matplotlibrO   r   r0   ÚFigureÚtextÚsavefig)r,   Úfilename_or_objr.   r-   rR   rM   rO   ÚparserÚwidthÚheightÚdepthÚ_Úfigs                r   Úmath_to_imager^   l   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)Ú__doc__rJ   ÚloggingrS   r&   r   r   Úmatplotlib.ft2fontr   Úmatplotlib.font_managerr   r   r	   r
   Ú	getLoggerrA   Ú_logrB   r   r^   rL   r    r   ú<module>re      sa   ðñó" Û ã ß &Ý (Ý 2÷1ñ 1ð €w×Ñ˜Ó"€ð  (Ð Ô ÷D=ñ D=ðN Øõ r    