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

129 lines
17 KiB
Plaintext
Raw Normal View History

Ë
†Rjê;ãó¬—dZddlZddlZddlZddlZddlmZddlZddlm Z ddl
Z ddl Z
ddl mZmZej e«Zddœd„ZGd„d «Zy)
aŠ
Support for embedded TeX expressions in Matplotlib.
Requirements:
* LaTeX.
* \*Agg backends: dvipng>=1.6.
* PS backend: PSfrag, dvips, and Ghostscript>=9.0.
* PDF and SVG backends: if LuaTeX is present, it will be used to speed up some
post-processing steps, but note that it is not used to parse the TeX string
itself (only LaTeX is supported).
To enable TeX rendering of all text in your Matplotlib figure, set
:rc:`text.usetex` to True.
TeX and dvipng/dvips processing results are cached
in ~/.matplotlib/tex.cache for reuse between sessions.
`TexManager.get_rgba` can also be used to directly obtain raster output as RGBA
NumPy arrays.
éN)ÚPath)ÚTemporaryDirectory)ÚcbookÚdviread©Úoptioncó&—|�d|›d�nd}d||dœzS)a$
Output LaTeX code that loads a package (possibly with an option) if it
hasn't been loaded yet.
LaTeX cannot load twice a package with different options, so this helper
can be used to protect against users loading arbitrary packages/options in
their custom preamble.
ú[ú]Úz]\makeatletter\@ifpackageloaded{%(package)s}{}{\usepackage%(option)s{%(package)s}}\makeatother©Úpackager©r
s úX/home/antigravity/intellecton/venv/lib/python3.12/site-packages/matplotlib/texmanager.pyÚ_usepackage_if_not_loadedr's1€ð%Ð0ˆq��˜‰]°b€Fð ð vÑ.ñ  /ð/óc
óò—eZdZdZej
j
ej«d«Z iZ
dZ idd“dd“dd “d
d “d d
“dd
“dd“dd“dd“dd“dd“dd“dd“dd“dd“dd“Z dddddddddddddœ Z
ejd „«Zed!„«Zed"„«Zed0d$„«Zed%„«Zed&„«Zed'„«Zed(„«Zed#d)œd*„«Zed+„«Zed,„«Zed1d-„«Zed2d.„«Zed0d/„«Zy#)3Ú
TexManagera
Convert strings to dvi files using TeX, caching the results to a directory.
The cache directory is called ``tex.cache`` and is located in the directory
returned by `.get_cachedir`.
Repeated calls to this constructor always return the same instance.
z tex.cache)Úserifú
sans-serifÚcursiveÚ monospaceúnew century schoolbookz\renewcommand{\rmdefault}{pnc}Úbookmanz\renewcommand{\rmdefault}{pbk}Útimesz\usepackage{mathptmx}Úpalatinoz\usepackage{mathpazo}ú
zapf chanceryz\usepackage{chancery}rÚcharterz\usepackage{charter}rr rÚ helveticaz\usepackage{helvet}ú avant gardez\usepackage{avant}Úcourierz\usepackage{courier}rz\usepackage{type1ec}úcomputer modern romanúcomputer modern sans serifúcomputer modern typewriter) rrrrrrrr r!r"r#r$cóx—t|j«jdd¬«tj |«S)NT©ÚparentsÚexist_ok)rÚ _texcacheÚmkdirÚobjectÚ__new__©Úclss rr,zTexManager.__new__js-€ä ˆS�]‰]Ó×!Ñ!¨$¸Ð!Ô>Ü�~‰~˜cÓ"Ð"rcóh—tjd}t|«dk(r|dj«nd}t|«dk(r||jvr|dfSt|«dk(r||j
vr|j |dfStjddj|j««y )
z<Return the font family name and whether the font is reduced.ú font.familyérNFTzXfont.family must be one of (%s) when text.usetex is True. serif will be used by default.ú, )rF)
ÚmplÚrcParamsÚlenÚlowerÚ_font_familiesÚ_font_preamblesÚ _font_typesÚ_logÚinfoÚjoin)r.ÚffÚff_vals rÚ_get_font_family_and_reducedz'TexManager._get_font_family_and_reducedos£€ô�\‰\˜-Ñ
(ˆÜ"% b£'¨Q¢,��A‘—‘”°DˆÜ ˆr‹7�aŠ<˜F c×&8Ñ&8Ñ8ؘ5�=Ð Ü
�‹W˜Š\˜f¨×(;Ñ(;Ñ;Ø—?‘? 6Ñ*¨DÐ0Ð 0ä �I‰Ið=à—i‘i × 2Ñ 2Ó3ô
5ð"rc
ó4—|j«\}}i}|jD�]}|r:||k(r5|jtjddj «||<Œ@tjd|›�}t
ttj
|««D]b\}}||jvsŒ|j|||<tjd||j|||dj|d|««ŒÝtjd|«|j|||<�ŒdD�chc]}||’Œ } }|dk(r| j|d«| jd «d
jt| ««}
|d k(rd n|d
k(rdnd} |
| fScc}w)Nr0rzfont.z.family: %s, package: %s, font: %s, skipped: %sr2zPNo LaTeX-compatible font found for the %s fontfamily in rcParams. Using default.)rrrrz\usepackage{type1cm}ú
rz \sffamilyrz \ttfamilyz \rmfamily)r?r7r8r3r4r6Ú enumerateÚmapÚstrr:Údebugr<r;ÚaddÚsorted) r.Úrequested_familyÚis_reduced_fontÚ preamblesÚ font_familyÚrcfontsÚiÚfontÚfamilyÚcmdÚpreambleÚfontcmds rÚ_get_font_preamble_and_commandz)TexManager._get_font_preamble_and_command~sÄ€à,/×,LÑ,LÓ,NÑ)И/àˆ Ø×-Ñ-ó NˆKÙ ;Ð2BÒ#BØ),×)<Ñ)<Ü—L‘L Ñ/°Ñ2×8Ñ8Ó:ñ*<� ˜+Ò&ôŸ,™,¨¨{¨mÐ'<Ñ=�Ü(¬¬S¯Y©Y¸Ó)@ÓAò
N‘G�A�tؘs×2Ñ2Ò2Ø14×1DÑ1DÀTÑ1J˜  +Ñ.ÜŸ
™
ØLØ'¨×)<Ñ)<¸TÑ)BÀGÈAÁJØ ŸI™I g¨b¨q kÓ2ôñ
ð
Nô—I‘IðCà)ô+ð.1×-@Ñ-@ÀÑ-M�I˜kÓ*ð' Nð0BöCØð˜Ó ðCˆðCà ˜yÒ (Ø �G‰G�I˜iÑ(Ô )Ø �‰Ð'Ô(Ø—9‘9œV C›[Ó)ˆØ#3°|Ò#C‘<Ø#3°{Ò#B‘<Øð ð˜Ð Ð ùòCsÄ/ FNcó’—|j||«t|«z}tj|j d«d¬«j «}t
|j«}d\}}td||z|«D]} |t
|| | dz«z }Œ|jdd¬«tjj||«S) zU
Return a filename based on a hash of the string, fontsize, and dpi.
úutf-8F)Úusedforsecurity)érWrrWTr&)
Ú_get_tex_sourcerDÚhashlibÚsha256ÚencodeÚ hexdigestrr)Úranger*ÚosÚpathr<)
r.ÚtexÚfontsizeÚdpiÚsrcÚfilehashÚfilepathÚ num_lettersÚ
num_levelsrMs
rÚ get_basefilezTexManager.get_basefile¥s¿€ð
×!Ñ! # xÓ0´3°s³8Ñ;ˆÜ—>‘>Ø �J‰J�wÓ Ø!ô
÷ ‰)‹+ð ô˜Ÿ
™
Ó&ˆà"&ш �ZÜ�q˜+ jÑ0°+Ó>ò 8ˆAؤ$ x°°!°A±# Ó"7Ñ7‰Hð 8ð �‰˜t¨dˆÔ3Ü�w‰w�|‰|˜H hÓ/Ð/rcó,—|j«\}}|S)zU
Return a string containing font configuration for the tex preamble.
)rS)r.Ú
font_preambleÚcommands rÚget_font_preamblezTexManager.get_font_preamble¸s€ð
"%×!CÑ!CÓ!Eш
�wØÐrcó(—tjdS)z>Return a string containing user additions to the tex preamble.ztext.latex.preamble)r3r4r-s rÚget_custom_preamblezTexManager.get_custom_preambleÀs€ô�|‰|Ð1Ñ2Ð2rc"óî—|j«\}}d|z}djddddd|dd d
d d d
|j«ddtdd¬«ddtd«ddddddd|›d|›d�dd |›d!|›d�d"g«S)#z;Return the complete TeX source for processing a TeX string.gô?rAz\documentclass{article}z=% Pass-through \mathdefault, which is used in non-usetex modez>% to use the default text font but was historically suppressedz% in usetex mode.z \newcommand{\mathdefault}[1]{#1}z\usepackage[utf8]{inputenc}z.\DeclareUnicodeCharacter{2212}{\ensuremath{-}}z3% geometry is loaded before the custom preamble as z<% convert_psfrags relies on a custom preamble to change the z % geometry.z1\usepackage[papersize=72in, margin=1in]{geometry}z?% Use `underscore` package to take care of underscores in text.z?% The [strings] option allows to use underscores in file names.Ú
underscoreÚstringsrz;% Custom packages (e.g. newtxtext) may already have loaded z"% textcomp with different options.Útextcompz\pagestyle{empty}z\begin{document}z>% The empty hbox ensures that a page is printed even for emptyz=% inputs, except when using psfrag which gets confused by it.z;% matplotlibbaselinemarker is used by dviread to detect thez% last line's baseline.z
\fontsize{z}{z}%z!\ifdefined\psfrag\else\hbox{}\fi%ú{ú z\end{document})rSr<rnr)r.r`rarjrRÚ baselineskips rrXzTexManager._get_tex_sourceÅsÀ€ð"%×!CÑ!CÓ!Eш
�wؘh‘ˆ Ø�y‰yØ &Ø LØ MØ Ø /Ø Ø *Ø =Ø BØ KØ Ø @Ø × #Ñ #Ó %Ø NØ NÜ % l¸9Ô EØ JØ 1Ü % jÓ 1Ø Ø Ø MØ LØ JØ &ؘ8˜* D¨¨°cÐ :Ø 0Ø�'�˜!˜C˜5 Ð $Ø ð;
ó ð rcóˆ—|j||«dz}t|«j|j||«d¬«|S)zv
Generate a tex file to render the tex string at a specific font size.
Return the file name.
ú.texrU©Úencoding)rhrÚ
write_textrX)r.r`raÚtexfiles rÚmake_texzTexManager.make_texêsI€ð×"Ñ" 3¨Ó1°FÑ:ˆÜ ˆW‹
× Ñ  ×!4Ñ!4°S¸(Ó!CØ*1ð !ô 3àˆr©Úcwdc ó—tjtj|«« t j
||�|n |j tj¬«}tj|«|S#t$r}td|d›d�«|‚d}~wtj$rc}tdj|dtj|«|jd«|jjdd«¬ ««d‚d}~wwxYw)
N)r~Ústderrz*Failed to process string with tex because rz could not be foundzŒ{prog} was not able to process the following string:
{tex!r}
Here is the full command invocation and its output:
{format_command}
{exc}
Úunicode_escaperUÚbackslashreplace)ÚprogÚformat_commandr`Úexc)r:rErÚ_pformat_subprocessÚ
subprocessÚ check_outputr)ÚSTDOUTÚFileNotFoundErrorÚ RuntimeErrorÚCalledProcessErrorÚformatr[ÚoutputÚdecode)r.rkr`r~Úreportr…s rÚ_run_checked_subprocessz"TexManager._run_checked_subprocessös€ä �
‰
”5×,Ñ,¨WÓ5Ô6ð Ü×,Ñ,Ø C O™S¸¿¹Ü!×(Ñ(ô*ˆFô&
�
‰
�6ÔØˆ
øô#!ò /ÜØ<¸WÀQ¹Z¸LðI%ð%ó&à+.ð
/ûô×,Ñ,ò Üð÷#™FØ  ™Ü#(×#<Ñ#<¸WÓ#EØŸ
™
Ð#3Ó4ØŸ
™
×)Ñ)¨'Ð3EÓFð #óHó
ðð
ûð ús$ª4A5Á5 D
Á>BÂD
Â'ADÄD
có—t|j||««jd«}|j«s²t |j
¬«5}t|d«j