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

80 lines
6.0 KiB
Plaintext
Raw Normal View History

Ë
†Rãó°dZddlZddlZddlZddlmZmZddlmZddl m
Z
ddlm Z m Z m
Z
eje«Zee
_Gdd «Zd dd
œd Zy)
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óÞeZdZdZej
ej ejejejejdœZ dZ dddœdZ
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)Úselfrs úV/home/antigravity/intellecton/venv/lib/python3.12/site-packages/matplotlib/mathtext.pyÚ__init__zMathTextParser.__init__0s*ô!× h¸ —<<“>ô#ˆÕó©Ú antialiasedcóè||j«nd}tj|d«}ddlm}t
j |j«dœ|j}|j|||||«S)
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`.
Nztext.antialiasedr)Ú backend_agg)rr)
ÚcopyÚmplÚ
_val_or_rcÚmatplotlib.backendsr$rÚ
NO_HINTINGÚget_hinting_flagrÚ
_parse_cached)rÚdpiÚpropr"r$Úload_glyph_flagss rÚparsezMathTextParser.parse>ssð".ˆty‰yŒ{°DˆÜ—n‘n [Ð2DÓ Ý×
ð ×
Ñ
ñÐð×! ! S¨$° Ð=MÓNr é2cóð|
t«}tj|j|j «¬«}|||«}|j «}|j €#tj«|j_|j j||||«} tj| «}
|jdk(r|
j«S|jdk(r|
j|¬«Sy)N)Úfontsetrrr!)rrrÚ_font_type_mappingÚget_math_fontfamilyÚget_size_in_pointsÚ_parserrÚParserÚ __class__r0ÚshiprÚ to_vectorÚ to_raster) rr,r-r.r"r/Ú
fontset_classr3ÚfontsizeÚboxrs rr+zMathTextParser._parse_cachedXà ˆ#ˆDÜ× × #¨T×-EÑ-EÓ-GôIˆ
á Ð&6ÓØ×,ˆà <‰<Ð Ü%.×%5Ñ%5Ó%7ˆDN‰NÔ l‰l× Ñ   G¨X°sÓÜ ÓØ × Ñ  Ò ×
×
Ñ
 
× Ð +r )éHN)Ú__name__Ú
__module__Ú __qualname__r7rÚ BakomaFontsÚDejaVuSerifFontsÚDejaVuSansFontsÚ StixFontsÚ
StixSansFontsÚ UnicodeFontsr4rr0Ú functoolsÚ lru_cacher+©r rr r %syØ€Gà × × × × × ×
Ðò O¸ôOð4€Y×јÓññ=r r )Úcolorcóêddlm}td«}|j|d|¬«\}} }
} } |j |dz | dz f¬«} | j d|
| z |||¬«| j
|||¬ «|
S)

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