� �)�Uc@ s;dZddlmZddlZddlmZddlmZyeWn!e k rmddl m ZnXddl Z ddl mZddlmZmZddlZdd lmZmZmZmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$e$j%�dd l&m'Z'dd l(m)Z)m*Z*m+Z+m,Z,dd l-m.Z.m/Z/m0Z0m1Z1m2Z2dd l3m4Z4m5Z5ddl6m7Z7m8Z8m9Z9m:Z:m;Z;ddl<m=Z=m>Z>ddl?j@ZAddlBjCZCd�ZDd�ZEdeFfd��YZGdeGfd��YZHdeGfd��YZId�ZJdeIfd��YZKd�ZLdeGfd��YZMdeGfd��YZNd eGfd!��YZOd"eGfd#��YZPd$eGfd%��YZQd&eFfd'��YZRd(eRfd)��YZSd*eSfd+��YZTd,eSfd-��YZUd.eUfd/��YZVd0eVfd1��YZWd2eRfd3��YZXd4ZYd5eYZZd6Z[d7Z\d8Z]d9Z^d:Z_d;Z`d<eafd=��YZbd>eFfd?��YZcd@ecfdA��YZddBedfdC��YZedDedfdE��YZfdFecfdG��YZgdHegfdI��YZhdJedfdK��YZidLeifdM��YZjdNeifdO��YZkdPedfdQ��YZldRelfdS��YZmdTelfdU��YZndVecfdW��YZodXeFfdY��YZpiepd:d5dZd:d[�d\6epd:d5d]d:d[�d^6epd:d5d_d:d[�d`6epd:d:d[d5dZ�da6epd:d:d[d5d]�db6epd:d:d[d5d_�dc6epd:d:d[d:d[�dd6epd:d5dZdedZ�df6ep_qdgeofdh��YZrdieofdj��YZsdkeofdl��YZtdmeofdn��YZudoeofdp��YZvdqeofdr��YZwdseofdt��YZxduejfdv��YZydwejfdx��YZzdyecfdz��YZ{d{ejfd|��YZ|d}ejfd~��YZ}dejfd���YZ~d�eFfd���YZe�Z�d��Z�d�eFfd���YZ�d�eFfd���YZ�dS(�s� :mod:`~matplotlib.mathtext` is a module for parsing a subset of the TeX math syntax and drawing them to a matplotlib backend. For a tutorial of its usage see :ref:`mathtext-tutorial`. This document is primarily concerned with implementation details. The module uses pyparsing_ to parse the TeX expression. .. _pyparsing: http://pyparsing.wikispaces.com/ 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. If you find TeX expressions that don't parse or render properly, please email mdroe@stsci.edu, but please check KNOWN ISSUES below first. i����(tdivisionN(tStringIO(tceil(tSet(twarn(tinftisinf(tCombinetGrouptOptionaltForwardtLiteralt OneOrMoret ZeroOrMoretParseExceptiontEmptyt ParseResultstSuppresstoneOft StringEndtParseFatalExceptiont FollowedBytRegext ParserElement(tAFM(tBunchtget_realpath_and_stattis_string_liketmaxdict(tFT2FonttFT2ImagetKERNING_DEFAULTtLOAD_FORCE_AUTOHINTtLOAD_NO_HINTING(tfindfonttFontProperties(tlatex_to_bakomatlatex_to_standardttex2unit latex_to_cmextstix_virtual_fonts(t get_data_pathtrcParamscC su|dkrdSyt|�SWntk r1nXyt|jd�SWn'tk rpdt�}t|�nXdS(s�get_unicode_index(symbol) -> integer Return the integer index (from the Unicode table) of symbol. *symbol* can be a single unicode character, a TeX command (i.e. r'\pi'), or a Type1 symbol name (i.e. 'phi'). t-i"s\sA'%(symbol)s' is not a valid Unicode character or TeX/Type1 symbolN(tordt TypeErrorR&tstriptKeyErrortlocalst ValueError(tsymboltmessage((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pytget_unicode_index<s    cC s-yt|�SWntk r(td�SXdS(s�Return the Unicode character corresponding to the index, or the replacement character if this is a narrow build of Python and the requested character is outside the BMP.i��N(tunichrR1(tindex((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyt unichr_safeUs tMathtextBackendcB sDeZdZd�Zd�Zd�Zd�Zd�Zd�ZRS(s� The base class for the mathtext backend-specific code. The purpose of :class:`MathtextBackend` subclasses is to interface between mathtext and a specific matplotlib graphics backend. Subclasses need to override the following: - :meth:`render_glyph` - :meth:`render_filled_rect` - :meth:`get_results` And optionally, if you need to use a Freetype hinting style: - :meth:`get_hinting_type` cC s d|_dS(N(tNonet fonts_object(tself((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyt__init__nscC s||_||_||_dS(sDimension the drawing canvasN(twidththeighttdepth(R;twthtd((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pytset_canvas_sizeqs  cC s t��dS(s_ Draw a glyph described by *info* to the reference point (*ox*, *oy*). N(tNotImplementedError(R;toxtoytinfo((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyt render_glyphwscC s t��dS(sR Draw a filled black rectangle from (*x1*, *y1*) to (*x2*, *y2*). N(RD(R;tx1ty1tx2ty2((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pytrender_filled_rect~scC s t��dS(sp Return a backend-specific tuple to return to the backend after all processing is done. N(RD(R;tbox((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyt get_results�scC stS(s\ Get the Freetype hinting type to use with this particular backend. (R!(R;((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pytget_hinting_type�s( t__name__t __module__t__doc__R<RCRHRMRORP(((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR8^s     tMathtextBackendBboxcB sMeZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z RS(so A backend whose only purpose is to get a precise bounding box. Only required for the Agg backend. cC s/tj|�ddddg|_||_dS(Ni(R8R<tbboxt real_backend(R;RV((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR<�s cC sYt|jd|�t|jd|�t|jd|�t|jd|�g|_dS(Niiii(tminRUtmax(R;RIRJRKRL((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyt _update_bbox�scC sB|j||jj||jj||jj||jj�dS(N(RYtmetricstxmintymaxtxmaxtymin(R;RERFRG((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyRH�s  cC s|j||||�dS(N(RY(R;RIRJRKRL((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pytrender_rect_filled�scC s�|j}|j}tdd|�|j}|dd|dd|dd|ddg}|j�|jj|d|d|d|d||d|d|�t|d |d |�|jj|�S(Niiii(R>R?tshipRUt_switch_to_real_backendR:RCRO(R;RNt orig_heightt orig_depthRU((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyRO�s   2  cC s |jj�S(N(RVRP(R;((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyRP�scC sH|j|j_|j|j_|jd|j_|jd|j_dS(Nii(RVR:tmathtext_backendRURERF(R;((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyRa�s( RQRRRSR<RYRHR_RORPRa(((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyRT�s      tMathtextBackendAggRendercB sDeZdZd�Zd�Zd�Zd�Zd�Zd�ZRS(s� Render glyphs and rectangles to an FTImage buffer, which is later transferred to the Agg image by the Agg backend. cC s,d|_d|_d|_tj|�dS(Ni(RERFR9timageR8R<(R;((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR<�s   cC s<tj||||�tt|�t||��|_dS(N(R8RCRRRf(R;R@RARB((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyRC�scC s-|jj|j|||jj|j�dS(N(tfonttdraw_glyph_to_bitmapRfRZticebergtglyph(R;RERFRG((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyRH�s cC s�tt||�dd�}|dkrR||d}t||dd�}n t|�}|jjt|�|t|�||�dS(Niig@(RXtintRftdraw_rect_filledR(R;RIRJRKRLR>tcenterty((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR_�s   cC s;|j|j|j|j|j|j|j|jj�fS(N(RERFR=R>R?RfR:tget_used_characters(R;RN((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyRO�s cC stdrtStSdS(Ns text.hinting(R*R R!(R;((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyRP�s ( RQRRRSR<RCRHR_RORP(((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyRe�s    cC s tt��S(N(RTRe(((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pytMathtextBackendAgg�stMathtextBackendBitmapRendercB seZd�ZRS(cC s|j|jfS(N(RfR?(R;RN((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyRO�s(RQRRRO(((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyRq�scC s tt��S(sn A backend to generate standalone mathtext images. No additional matplotlib backend is required. (RTRq(((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pytMathtextBackendBitmap�stMathtextBackendPscB s2eZdZd�Zd�Zd�Zd�ZRS(sX Store information to write a mathtext rendering to the PostScript backend. cC st�|_d|_dS(N(RtpswriterR9tlastfont(R;((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR<s cC s�|j||j}|j}|j}|j}||f|jkrsdt�}||f|_|jj|�ndt�}|jj|�dS(Ns=/%(postscript_name)s findfont %(fontsize)s scalefont setfont s1%(ox)f %(oy)f moveto /%(symbol_name)s glyphshow ( R>toffsettpostscript_nametfontsizet symbol_nameRuR0Rttwrite(R;RERFRGRwRxRytps((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyRHs     cC s9d||j|||||f}|jj|�dS(Ns%f %f %f %f rectfill (R>RtRz(R;RIRJRKRLR{((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR_s%cC sCtd|j |�|j|j|j|j|j|jj�fS(Ni(R`R?R=R>RtR:Ro(R;RN((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyROs  (RQRRRSR<RHR_RO(((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyRs�s    tMathtextBackendPdfcB s2eZdZd�Zd�Zd�Zd�ZRS(sQ Store information to write a mathtext rendering to the PDF backend. cC sg|_g|_dS(N(tglyphstrects(R;((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR<*s cC sO|jj}|j||j}|jj||||j|j|jf�dS(N( RgtfnameR>RvR}tappendRxtnumRy(R;RERFRGtfilename((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyRH.s   cC s/|jj||j|||||f�dS(N(R~R�R>(R;RIRJRKRL((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR_5scC sItd|j |�|j|j|j|j|j|j|jj�fS(Ni(R`R?R=R>R}R~R:Ro(R;RN((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyRO8s (RQRRRSR<RHR_RO(((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR|%s    tMathtextBackendSvgcB s2eZdZd�Zd�Zd�Zd�ZRS(sQ Store information to write a mathtext rendering to the SVG backend. cC sg|_g|_dS(N(t svg_glyphst svg_rects(R;((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR<Fs cC sR|j||j}t|j�}|jj|j|j||||jf�dS(N( R>RvR7R�R�R�RgRxRZ(R;RERFRGtthetext((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyRHJs cC s3|jj||j|d||||f�dS(Ni(R�R�R>(R;RIRJRKRL((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR_Qs cC s[td|j |�td|jd|j�}|j|j|j|j||jj�fS(NiR�R�( R`R?RR�R�R=R>R:Ro(R;RNt svg_elements((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyROUs  (RQRRRSR<RHR_RO(((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR�As    tMathtextBackendPathcB s2eZdZd�Zd�Zd�Zd�ZRS(sS Store information to write a mathtext rendering to the Cairo backend. cC sg|_g|_dS(N(R}R~(R;((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR<es cC sL|j||j}t|j�}|jj|j|j|||f�dS(N(R>RvR7R�R}R�RgRx(R;RERFRGR�((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyRHis cC s/|jj||j|||||f�dS(N(R~R�R>(R;RIRJRKRL((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR_os cC s=td|j |�|j|j|j|j|j|jfS(Ni(R`R?R=R>R}R~(R;RN((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyROss  (RQRRRSR<RHR_RO(((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR�_s    tMathtextBackendCairocB s2eZdZd�Zd�Zd�Zd�ZRS(sS Store information to write a mathtext rendering to the Cairo backend. cC sg|_g|_dS(N(R}R~(R;((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR<�s cC sL||j|j}t|j�}|jj|j|j|||f�dS(N(RvR>R7R�R}R�RgRx(R;RERFRGR�((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyRH�s cC s/|jj|||j||||f�dS(N(R~R�R>(R;RIRJRKRL((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR_�s cC s=td|j |�|j|j|j|j|j|jfS(Ni(R`R?R=R>R}R~(R;RN((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyRO�s  (RQRRRSR<RHR_RO(((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR�{s    tFontscB szeZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z d �Z d �Z d �Z d �ZRS( s� An abstract base class for a system of fonts to use for mathtext. The class must be able to take symbol keys and font file names and return the character metrics. It also delegates to a backend class to do the actual drawing. cC s+||_||_||j_i|_dS(sH *default_font_prop*: A :class:`~matplotlib.font_manager.FontProperties` object to use for the default non-math font, or the base font for Unicode (generic) font rendering. *mathtext_backend*: A subclass of :class:`MathTextBackend` used to delegate the actual rendering. N(tdefault_font_propRdR:tused_characters(R;R�Rd((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR<�s   cC s d|_dS(sa Fix any cyclical references before the object is about to be destroyed. N(R9R�(R;((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pytdestroy�sc C sdS(su Get the kerning distance for font between *sym1* and *sym2*. *fontX*: one of the TeX font names:: tt, it, rm, cal, sf, bf or default/regular (non-math) *fontclassX*: TODO *symX*: a symbol in raw TeX form. e.g. '1', 'x' or '\sigma' *fontsizeX*: the fontsize in points *dpi*: the current dots-per-inch g(( R;tfont1t fontclass1tsym1t fontsize1tfont2t fontclass2tsym2t fontsize2tdpi((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pytget_kern�scC s"|j|||||�}|jS(s *font*: one of the TeX font names:: tt, it, rm, cal, sf, bf or default/regular (non-math) *font_class*: TODO *sym*: a symbol in raw TeX form. e.g. '1', 'x' or '\sigma' *fontsize*: font size in points *dpi*: current dots-per-inch Returns an object with the following attributes: - *advance*: The advance distance (in points) of the glyph. - *height*: The height of the glyph in points. - *width*: The width of the glyph in points. - *xmin*, *xmax*, *ymin*, *ymax* - the ink rectangle of the glyph - *iceberg* - the distance from the baseline to the top of the glyph. This corresponds to TeX's definition of "height". (t _get_infoRZ(R;Rgt font_classtsymRxR�RG((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyt get_metrics�scC sRt|�t|�t|�|_|_|_|jj|j|j|j�dS(s� Set the size of the buffer used to render the math expression. Only really necessary for the bitmap backends. N(RR=R>R?RdRC(R;R@RARB((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyRC�s/c C s|j|||||�}t|jj�\} } |jj| | t�f�} | dj|j�|j j |||�dS(s Draw a glyph at - *ox*, *oy*: position - *facename*: One of the TeX face names - *font_class*: - *sym*: TeX symbol name or single character - *fontsize*: fontsize in points - *dpi*: The dpi to draw at. iN( R�RRgRR�t setdefaulttsettaddR�RdRH( R;RERFtfacenameR�R�RxR�RGtrealpathtstat_keyR�((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyRH�s  cC s|jj||||�dS(sL Draw a filled rectangle from (*x1*, *y1*) to (*x2*, *y2*). N(RdR_(R;RIRJRKRL((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR_scC s t��dS(sF Get the xheight for the given *font* and *fontsize*. N(RD(R;RgRxR�((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyt get_xheightscC s t��dS(s� Get the line thickness that matches the given font. Used as a base unit for drawing lines such as in a fraction or radical. N(RD(R;RgRxR�((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pytget_underline_thicknessscC s|jS(s� Get the set of characters that were used in the math expression. Used by backends that need to subset fonts so they know which glyphs to include. (R�(R;((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyRoscC s|jj|�S(s� Get the data needed by the backend to render the math expression. The return value is backend-specific. (RdRO(R;RN((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyRO#scC s ||fgS(s Override if your font provides multiple sizes of the same symbol. Should return a list of symbols matching *sym* in various sizes. The expression renderer will select the most appropriate size for a given situation from this list. ((R;tfontnameR�((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyt!get_sized_alternatives_for_symbol*s(RQRRRSR<R�R�R�RCRHR_R�R�RoROR�(((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR��s           t TruetypeFontscB sieZdZdd d��YZd�Zd�Zd�Zd�Zd�Zd�Z d �Z d �Z RS( sa A generic base class for all font setups that use Truetype fonts (through FT2Font). t CachedFontcB seZd�Zd�ZRS(cC sS||_|j�|_tg|jj�D]\}}||f^q+�|_dS(N(Rgt get_charmaptcharmaptdictt iteritemstglyphmap(R;Rgtccodetglyphind((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR<9s cC s t|j�S(N(treprRg(R;((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyt__repr__?s(RQRRR<R�(((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR�8s cC sjtj|||�i|_i|_t|�}|jtt|���}||jd<||jd<dS(Ntdefaulttregular(R�R<tglyphdt_fontsR"R�Rtstr(R;R�RdR�t default_font((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR<Bs    cC sd|_tj|�dS(N(R9R�R�R�(R;((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR�Ls cC s�||jkr|j|}n|}|jj|�}|dkr�tt|��}|j|�}||j|<||j|j<||j|jj�<n|S(N( tfontmapR�tgetR9RR�R�Rwtlower(R;Rgtbasenamet cached_font((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyt _get_fontPs  cC s1|jjdkr-|jddd|dSdS(NtCmex10gP@g@gp@gR@gg@(RgRwR>(R;R�RjRxR�((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyt _get_offset_scC s�|||||f}|jj|�}|dk r7|S|j||||�\}} } }} |j} | j||�| j| d|jj��} g| j D]}|d^q�\}}}}|j || ||�}t d| j dd| j dd| jdd|d|d ||d ||d | jd|d | � }t d | d|d| jd|d| d| d| d|�}|j|<|S(NtflagsgP@tadvanceg�@R>R=R[R]R^R\RitslantedRgRxRwRZRyR�RjRv(R�R�R9t _get_glyphRgtset_sizet load_charRdRPRUR�RtlinearHoriAdvanceR>R=t horiBearingYRw(R;R�R�R�RxR�tkeytbunchR�R�RyR�RgRjtvalR[R^R]R\RvRZtresult((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR�ds@ ' ,       cC s�|j|�}|jj||�|jjd�}|dkrf|j|tdd||�}|jS|dd|d|d}|S(Ntpcltsmathtext.defaulttxtxHeightgP@g(@gY@(R�RgR�tget_sfnt_tableR9R�R*Ri(R;RgRxR�R�R�RZR�((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR��s cC sd||dS(Ng�?g(@gR@g�?((R;RgRxR�((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR��sc C s�||krt||krt|j||||| �} |j||||| �} | j} | j| j| jt�dStj|||||||||| � S(NgP@(R�Rgt get_kerningR�RR�R�( R;R�R�R�R�R�R�R�R�R�tinfo1tinfo2Rg((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR��s (( RQRRRSR�R<R�R�R�R�R�R�R�(((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR�3s    * t BakomaFontscB seZdZidd6dd6dd6dd6d d 6d d 6d d6Zd�Zedj��Zd�Zidkdldmdndogd6dpdqdrdsdtgd6dudvdwdxdygd6dzd{d|d}d~gd 6dd�d�d�gd$6d�d�d�d�gd(6d�d�d�d�gd06d�d�d�d�gd56d�d�d�d�gd:6d�d�d�d�gd?6d�d�d�d�gdD6d�d�d�d�gdI6d�d�d�d�gdN6d�d�d�d�gdS6d�d�d�d�d�gdP6d�d�d�d�gd\6d�d�d�d�gda6d�d�gdb6d�d�gdc6Z x4d�d�d�d�d�d�gD]\Z Z e e e e <q�Wdj�Z RS(�s� Use the Bakoma TrueType fonts for rendering. Symbols are strewn about a number of font files, each of which has its own proprietary 8-bit encoding. tcmsy10tcaltcmr10trmtcmtt10ttttcmmi10tittcmb10tbftcmss10tsftcmex10texcO sxt||�|_tj|||�i|_xC|jj�D]2\}}t|�}||j|<||j|<q>WdS(N(t StixFontst_stix_fallbackR�R<R�t_fontmapR�R"(R;targstkwargsR�R�tfullpath((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR<�s   s \int \ointc C s[d}||jkr�|tkr�t|\}}|dkpI||jk}y|j|�} Wntk rrq#X| jj|�}| j|}n�t |�dkr#|dk}y|j|�} Wntk r�q#Xt |�}| j j |�} | dk r#| jj| j |�}q#n|dkrH|j j||||�S| ||||fS(NR�iR�(R9R�R$t_slanted_symbolsR�t RuntimeErrorRgtget_glyph_nameR�tlenR,R�R�R�R�( R;R�R�R�RxRyR�R�R�R�tgid((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR��s2        t(s�s�s�s�t)s�s�s�s!t{s�tns�t}s�tos�t[s�RAs"t]s�tis#s�tjs�s$s\lfloors�tks�s%s\rfloors�tls�s&s\lceils�tms�s's\rceils�tDs�s*s\langles�tEs�s+s\rangletptqtrtss \__sqrt__s�s/s�s-s \backslashs�s.s�s,s^tbtcRBs\widehats~tetftgs \widetildet<t>s \leftparens ightparents \leftbraces ightbraces \leftbrackets ightbracketcC s|jj|||fg�S(N(t_size_alternativesR�(R;R�R�((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR�s(R�R�(R�s�(R�s�(R�s�(R�s�(R�R�(R�s�(R�s�(R�s�(R�s!(R�R�(R�s�(R�sn(R�s�(R�R�(R�R�(R�s�(R�so(R�s�(R�R�(R�R�(R�s�(R�sh(R�s"(R�R�(R�s�(R�si(R�s#(R�s�(R�sj(R�s�(R�s$(R�s�(R�sk(R�s�(R�s%(R�s�(R�sl(R�s�(R�s&(R�s�(R�sm(R�s�(R�s'(R�s�(R�sD(R�s�(R�s*(R�s�(R�sE(R�s�(R�s+(R�sp(R�sq(R�sr(R�ss(R�s�(R�s/(R�s�(R�s-(R�s/(R�s�(R�s.(R�s�(R�s,(R�s^(R�sb(R�sc(R�sd(R�s~(R�se(R�sf(R�sg(R�sh(R�sD(R�si(R�sE(s \leftparenR�(s ightparentR�(s \leftbraceR�(s ightbraceR�(s \leftbracketR�(s ightbracketR�( RQRRRSR�R<R�tsplitR�R�RtaliasttargetR�(((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR��sp    "                           t UnicodeFontscB sJeZdZeZd�Zedj��Zd�Z d�Z d�Z RS(sa An abstract base class for handling Unicode fonts. While some reasonably complete Unicode fonts (such as DejaVu) may work in some situations, the only Unicode font I'm aware of with a complete set of math symbols is STIX. This class will "fallback" on the Bakoma fonts when a required symbol can not be found in the font. cO s�tdrt||�|_n d|_tj|||�i|_x;dj�D]-}td|}t|�}||j|<qQWt d�}t|�}||jd<dS(Nsmathtext.fallback_to_cmscal rm tt it bf sfs mathtext.R�R�( R*R�t cm_fallbackR9R�R<R�RR"R#(R;R�R�ttexfonttpropRg((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR<)s      s \int \ointcC s ||fS(N((R;R�R�tuniindex((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyt_map_virtual_font;sc C s�t}|jr<tj|�}|dk r<d}t}q<n|s�yt|�}t}Wq�tk r�td�}t d|j dd�t �q�Xn|j |||�\}}|}|r�|dkr$|dkr$t |�}tj|�dd k stj|�jd �r!d }q!q$n|dkp<||jk} t}y|j|�} Wntk rkq�Xy| j|} t}Wq�tk r�q�Xn|sj|jr�t d t �|jj|d||�S|dkrt|t�r|jd |||�St d||j dd�|ft �t dt �d }|}|j|�} d}| j|} t} n| jj| �} | || || fS(NR�t?s"No TeX to unicode mapping for '%s'tasciitbackslashreplaceR�iitLs GREEK CAPITALR�s0Substituting with a symbol from Computer Modern.R�s.Font '%s' does not have a glyph for '%s' [U%x]s!Substituting with a dummy symbol.i�(sitsregular(tFalsetuse_cmexR'R�R9tTrueR4R1R,RtencodetMathTextWarningRR5t unicodedatatcategorytnamet startswithR�R�R�R�R/R R�t isinstanceR�RgR�( R;R�R�R�Rxt found_symbolRt new_fontnamet unistringR�R�t glyphindexRy((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR�>sp                   cC s)|jr|jj||�S||fgS(N(R R�(R;R�R�((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR��s   ( RQRRRSRRR<R�RR�RR�R�(((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR s    FR�cB s�eZdZi dd6dd6dd6dd6d d 6d d 6dd 6dd6dd6dd6dd6dd6ZeZeZeZd�Zd�Z iZ d�Z RS(sa A font handling class for the STIX fonts. In addition to what UnicodeFonts provides, this class: - supports "virtual fonts" which are complete alpha numeric character sets with different font styles at special Unicode code points, such as "Blackboard". - handles sized alternative characters for the STIXSizeX fonts. t STIXGeneralR�sSTIXGeneral:italicR�sSTIXGeneral:weight=boldR�tSTIXNonUnicodetnonunirmsSTIXNonUnicode:italictnonuniitsSTIXNonUnicode:weight=boldtnonunibfitSTIXSizeOneSymitSTIXSizeTwoSymitSTIXSizeThreeSymitSTIXSizeFourSymitSTIXSizeFiveSymicO sftj|||�i|_xC|jj�D]2\}}t|�}||j|<||j|<q,WdS(N(R�R<R�R�R�R"(R;R�R�R�RR�((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR<�s    c C s�tj|�}|jrC|dkrC|dkrCtd}t}nt}|dk rLt|t�ry|j|d�}nd}t|�}x_||kr�||d}||} || dkr�|}q�|| dkr�Pq�|d}q�W|| dkr0|| dkr0|| d| d}| d}qL|sLd}t d }qLn|dkr}|d kr}|d kr}d|}n||fS(NR�R�R�R�iiiismathtext.defaultR�R�i�i��tnonuni(sregularsdefault(sitsrmsbf( R(R�t_sansR9RRRR�R�R*( R;R�R�Rtmappingtdoing_sans_conversiontlothitmidtrange((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR�s:           c C s |jj|�}|r|Sg}yt|�}Wntk rO||fgSXidtd�6dtd�6}|j||�}x]td�D]O}|j|�}|jj|�}|dk r�|j |t |�f�q�q�W|dkr�|d }n||j|<|S(Ni�'Ri�'Ris \__sqrt__i����( RR�R4R1R,R3R�R�R9R�R7( R;R�R�t alternativesRtfix_upsR�R�R!((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR��s*       ( RQRRRSR�RRR R-R<RRR�(((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR��s(     +t StixSansFontscB seZdZeZRS(sd A font handling class for the STIX fonts (that uses sans-serif characters by default). (RQRRRSRR-(((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR6�stStandardPsFontscB s�eZdZejje�dd�Zidd6dd6dd6d d 6d d 6d d6dd6Z d�Z d�Z d�Z d�Z d�Zd�ZRS(s� Use the standard postscript fonts for rendering to backend_ps Unlike the other font classes, BakomaFont and UnicodeFont, this one requires the Ps backend. tfontstafmtpzcmi8aR�tpncr8aR�tpcrr8aR�tpncri8aR�tphvr8aR�tpncb8aR�tpsyrcC s�tj||t��i|_i|_t|ddd|j�}|dkrmtdddd|j�}ntt |d��}||_ ||jd<||jd<t �|_ dS(NtfontextR9t directoryt HelveticaR�R�R�( R�R<RsR�R8R"tbasepathR9RtfileRRRt(R;R�R�R�((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR<s       cC s�||jkr|j|}n|}|jj|�}|dkr�tjj|j|d�}tt |d��}||_ ||j|<||j|j �<n|S(Ns.afmR�( R�R8R�R9tostpathtjoinRDRRERt get_fontname(R;RgR�R�R((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR�%s   cC s�||||f}|jj|�}|dk r4|S|dkrzt|�dksqtjt|��jd� rzd}nt}|t kr�t |\}} t | �} t }n>t|�dkr�|} t | �} t }nt d|t�|dk} |j|�} |rZy| j| �} WqZtk rVt d| j|ft�t}qZXn|s�d} }t | �} | j| �} nd}d |}g| j| �D]}||^q�\}}}}td | j| �|d | j| �|d | j| �|d |d|d||d||d||d| � }td| d|d| j�d|d| d| d| d|�|j|<|j|S(s/load the cmfont, metrics and glyph with cachingR�iRR�s.No TeX to built-in Postscript mapping for '%s's2No glyph in standard Postscript font '%s' for '%s'Rig����MbP?R�R=R>R[R]R^R\RiR�RgRxRwRZRyR�RjRvN(R�R�R9R�RRtunicodeRRR%tchrRR,RRR�t get_name_charR/Rwt get_bbox_charRtget_width_chartget_height_charRI(R;R�R�R�RxR�R�ttupRR�RjR�RgRyRvtscaleR�R[R^R]R\RZ((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR�4sr                /     c C s�||kru||kru|j||||| �} |j||||| �} | j} | j| j| j�d|Stj|||||||||| � S(Ng����MbP?(R�Rgt get_kern_distRjR�R�( R;R�R�R�R�R�R�R�R�R�R�R�Rg((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR��s cC s!|j|�}|j�d|S(Ng����MbP?(R�R�(R;RgRxR�R�((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR��scC s!|j|�}|j�d|S(Ng����MbP?(R�R�(R;RgRxR�R�((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR��sN(RQRRRSRFRGRHR)RDR9R�R<R�R�R�R�R�(((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR7s     N gffffff�?g�?ig�������?g333333�?g�?gg ףp= �?RcB seZRS((RQRR(((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR�stNodecB sMeZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z RS(s% A node in the TeX box model cC s d|_dS(Ni(tsize(R;((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR<�scC s |j�S(N(t__internal_repr__(R;((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR��scC s |jjS(N(t __class__RQ(R;((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyRU�scC sdS(Ng((R;tnext((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR��scC s|jd7_dS(s� Shrinks one level smaller. There are only three levels of sizes, after which things will no longer get smaller. iN(RT(R;((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pytshrink�scC s|jd8_dS(sb Grows one level larger. There is no limit to how big something can get. iN(RT(R;((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pytgrow�scC sdS(N((R;R�Rn((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pytrender�s( RQRRRSR<R�RUR�RXRYRZ(((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyRS�s      tBoxcB s2eZdZd�Zd�Zd�Zd�ZRS(s7 Represents any node with a physical location. cC s,tj|�||_||_||_dS(N(RSR<R=R>R?(R;R=R>R?((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR<�s   cC sPtj|�|jtkrL|jt9_|jt9_|jt9_ndS(N(RSRXRTtNUM_SIZE_LEVELSR=t SHRINK_FACTORR>R?(R;((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyRX�s  cC s>tj|�|jt9_|jt9_|jt9_dS(N(RSRYR=t GROW_FACTORR>R?(R;((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyRY�s cC sdS(N((R;RIRJRKRL((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyRZ�s(RQRRRSR<RXRYRZ(((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR[�s    tVboxcB seZdZd�ZRS(s. A box with only height (zero width). cC stj|d||�dS(Ng(R[R<(R;R>R?((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR<s(RQRRRSR<(((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR_�stHboxcB seZdZd�ZRS(s8 A box with only width (zero height and depth). cC stj||dd�dS(Ng(R[R<(R;R=((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR<s(RQRRRSR<(((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR`stCharcB sVeZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z RS( s# Represents a single character. Unlike TeX, the font information and metrics are stored with each :class:`Char` to make it easier to lookup the font metrics when needed. Note that TeX boxes have a width, height, and depth, unlike Type1 and Truetype which use a full bounding box and an advance in the x-direction. The metrics must be converted to the TeX way, and the advance (if different from width) must be converted into a :class:`Kern` node when the :class:`Char` is added to its parent :class:`Hlist`. cC s�tj|�||_|j|_t|jtttf�sCt �|j|_|j |_ |j |_ |j |_ |j �dS(N(RSR<Rt font_outputRRgR�RJRktAssertionErrorR�RxR�t_update_metrics(R;Rtstate((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR<s   !    cC s d|jS(Ns`%s`(R(R;((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyRU#scC s�|jj|j|j|j|j|j�}|_|jdkrR|j|_ n |j |_ |j |_ |j |j  |_ dS(Nt ( RbR�RgR�RRxR�t_metricsR�R=RiR>R?(R;RZ((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyRd&s +  cC s |jjS(N(RgR�(R;((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyt is_slanted0sc C sx|jj|j}d}t|t�rp|jj|j|j|j |j |j|j|j |j |j � }n||S(s� Return the amount of kerning between this and the given character. Called when characters are strung together into :class:`Hlist` to create :class:`Kern` nodes. g( RgR�R=RRaRbR�RgR�RRxR�(R;RWR�tkern((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR�3s cC s5|jj|||j|j|j|j|j�dS(s4 Render the character to the canvas N(RbRHRgR�RRxR�(R;R�Rn((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyRZBs cC s_tj|�|jtkr[|jt9_|jt9_|jt9_|jt9_ndS(N( RSRXRTR\RxR]R=R>R?(R;((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyRXJs  cC sMtj|�|jt9_|jt9_|jt9_|jt9_dS(N(RSRYRxR^R=R>R?(R;((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyRYRs  ( RQRRRSR<RURdRhR�RZRXRY(((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyRa s      tAccentcB s2eZdZd�Zd�Zd�Zd�ZRS(s� The font metrics need to be dealt with differently for accents, since they are already offset correctly from the baseline in TrueType fonts. cC sg|jj|j|j|j|j|j�}|_|j|j |_ |j |j |_ d|_dS(Ni(RbR�RgR�RRxR�RgR]R[R=R\R^R>R?(R;RZ((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyRd_s  +cC stj|�|j�dS(N(RaRXRd(R;((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyRXfs cC stj|�|j�dS(N(RaRYRd(R;((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyRYjs cC sI|jj||jj||jj|j|j|j|j|j �dS(s5 Render the character to the canvas. N( RbRHRgR[R^RgR�RRxR�(R;R�Rn((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyRZns (RQRRRSRdRXRYRZ(((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyRjYs    tListcB sDeZdZd�Zd�Zd�Zd�Zd�Zd�ZRS(s: A list of nodes (either horizontal or vertical). cC sGtj|ddd�d|_||_d|_d|_d|_dS(Ngi(R[R<t shift_amounttchildrentglue_sett glue_signt glue_order(R;telements((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR<zs     c C sQd|j�|j|j|j|jdjg|jD]}t|�^q4�fS(Ns![%s <%.02f %.02f %.02f %.02f> %s]Rf(RUR=R>R?RlRHRmR�(R;R�((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR��s    cC sKd}x>tt|�ddd�D] }||dkr#|}Pq#q#W|S(s� A helper function to determine the highest order of glue used by the members of this list. Used by vpack and hpack. iii����g(R3R�(R;ttotalsR�R�((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyt_determine_order�s #cC s�|j|�}||_||_||dkrE||||_nd|_d|_|dkr�t|j�r�td||jj |ft �q�ndS(Ngis %s %s: %r( RsRpRoRnt glue_ratioR�RmRRVRQR(R;R�tsignRrt error_typeR�((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyt _set_glue�s     cC s_x|jD]}|j�q Wtj|�|jtkr[|jt9_|jt9_ndS(N(RmRXR[RTR\RlR]Rn(R;tchild((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyRX�s  cC sMx|jD]}|j�q Wtj|�|jt9_|jt9_dS(N(RmRYR[RlR^Rn(R;Rx((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyRY�s  ( RQRRRSR<R�RsRwRXRY(((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyRkvs   tHlistcB s8eZdZdded�Zd�Zddd�ZRS(s% A horizontal list of boxes. gt additionalcC s1tj||�|r#|j�n|j�dS(N(RkR<Rithpack(R;RqR@R�tdo_kern((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR<�s cC s�g}t|j�}|r�x�t|�D]�}|j|}||dkr_|j|d}nd}|j|�|j|�}|dkr(t|�}|j|�q(q(W||_ndS(s) Insert :class:`Kern` nodes between :class:`Char` nodes to set kerning. The :class:`Char` nodes themselves determine the amount of kerning they need (in :meth:`~Char.get_kerning`), and this function just creates the linked list in the correct way. igN(R�RmR3R9R�R�tKern(R;t new_childrent num_childrenR�telemRWtkerning_distanceRi((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyRi�s    c C sd}d}d}dgd}dgd}xG|jD]<}t|t�r||j7}t||j�}t||j�}q6t|t�r�||j7}t|j� rrt|j� rrt |dd�} t||j| �}t||j| �}qrq6t|t �rS|j } || j7}|| j c| j 7<|| jc| j7<q6t|t�r6||j7}q6q6W||_||_|dkr�||7}n||_||}|dkr�d|_d|_d|_dS|dkr|j|d|d�n|j|d |d �dS( s The main duty of :meth:`hpack` is to compute the dimensions of the resulting boxes, and to adjust the glue if one of those dimensions is pre-specified. The computed sizes normally enclose all of the material inside the new box; but some items may stick out if negative glue is used, if the box is overfull, or if a ``\vbox`` includes other boxes that have been shifted left. - *w*: specifies a width - *m*: is either 'exactly' or 'additional'. Thus, ``hpack(w, 'exactly')`` produces a box whose width is exactly *w*, while ``hpack(w, 'additional')`` yields a box whose width is the natural width plus *w*. The default values produce a box with the natural width. giRlRziNitOverfulli����t Underfull(RmRRaR=RXR>R?R[RtgetattrtGluet glue_spect stretch_ordertstretcht shrink_orderRXR}RoRpRtRw( R;R@R�RARBR�t total_stretcht total_shrinkR�R�R�((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR{�sJ                  (RQRRRSRR<RiR{(((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyRy�s &tVlistcB s5eZdZddd�Zddee�d�ZRS(s# A vertical list of boxes. gRzcC stj||�|j�dS(N(RkR<tvpack(R;RqRAR�((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR<&sc C sd}d}d}dgd}dgd}x"|jD]} t| t�r�||| j7}| j}t| j�sMt| dd�} t|| j| �}qMq6t| t �r||7}d}| j } || j7}|| j c| j 7<|| j c| j7<q6t| t�r/||| j7}d}q6t| t�r6td��q6q6W||_||kr�|||7}||_n ||_|dkr�||7}n||_||}|dkr�d|_d|_d|_dS|dkr|j|d|d �n|j|d |d �dS( s6 The main duty of :meth:`vpack` is to compute the dimensions of the resulting boxes, and to adjust the glue if one of those dimensions is pre-specified. - *h*: specifies a height - *m*: is either 'exactly' or 'additional'. - *l*: a maximum height Thus, ``vpack(h, 'exactly')`` produces a box whose height is exactly *h*, while ``vpack(h, 'additional')`` yields a box whose height is the natural height plus *h*. The default values produce a box with the natural width. giRls2Internal mathtext error: Char node found in Vlist.RziNiR�i����R�(RmRR[R>R?RR=R�RXR�R�R�R�R�RXR}RaR�RoRpRtRw( R;RAR�R�R@RBR�R�R�R�R�R�((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR�*sR                    (RQRRRSR<tfloatRR�(((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR�"stRulecB s eZdZd�Zd�ZRS(s� A :class:`Rule` node stands for a solid black rectangle; it has *width*, *depth*, and *height* fields just as in an :class:`Hlist`. However, if any of these dimensions is inf, the actual value will be determined by running the rule up to the boundary of the innermost enclosing box. This is called a "running dimension." The width is never running in an :class:`Hlist`; the height and depth are never running in a :class:`Vlist`. cC s&tj||||�|j|_dS(N(R[R<Rb(R;R=R>R?Re((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR<vscC s%|jj||||||�dS(N(RbR_(R;R�RnR@RA((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyRZzs(RQRRRSR<RZ(((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR�ls  tHrulecB seZdZdd�ZRS(s8 Convenience class to create a horizontal rule. cC s[|dkr0|jj|j|j|j�}n|d}}tj|t|||�dS(Ng�?( R9RbR�RgRxR�R�R<R(R;Ret thicknessR>R?((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR<�s   N(RQRRRSR9R<(((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR�}stVrulecB seZdZd�ZRS(s6 Convenience class to create a vertical rule. cC s>|jj|j|j|j�}tj||tt|�dS(N(RbR�RgRxR�R�R<R(R;ReR�((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR<�s (RQRRRSR<(((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR��sR�cB s,eZdZed�Zd�Zd�ZRS(s Most of the information in this object is stored in the underlying :class:`GlueSpec` class, which is shared between multiple glue objects. (This is a memory optimization which probably doesn't matter anymore, but it's easier to stick to what TeX does.) cC sztj|�d|_t|�r4tj|�}n$t|t�rL|}n td��|rm|j�}n||_ dS(Ntnormals/glue_type must be a glue spec name or instance.( RSR<t glue_subtypeRtGlueSpectfactoryRt ArgumentErrortcopyR�(R;t glue_typeR�R�((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR<�s     cC s\tj|�|jtkrX|jjdkrX|jj�|_|jjt9_qXndS(Ng(RSRXRTR\R�R=R�R](R;((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyRX�s  cC sJtj|�|jjdkrF|jj�|_|jjt9_ndS(Ng(RSRYR�R=R�R^(R;((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyRY�s (RQRRRSRR<RXRY(((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR��s R�cB sDeZdZdddddd�Zd�Zd�Zee�ZRS(s See :class:`Glue`. gicC s1||_||_||_||_||_dS(N(R=R�R�RXR�(R;R=R�R�RXR�((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR<�s     cC s%t|j|j|j|j|j�S(N(R�R=R�R�RXR�(R;((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR��s cC s |j|S(N(t_types(tclsR�((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR��s(RQRRRSR<R�R�t classmethod(((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR��s   iitfilitfillitfillltneg_filtneg_fillt neg_fillltemptyg�tsstFilcB seZd�ZRS(cC stj|d�dS(NR�(R�R<(R;((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR<�s(RQRRR<(((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR��stFillcB seZd�ZRS(cC stj|d�dS(NR�(R�R<(R;((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR<�s(RQRRR<(((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR��stFilllcB seZd�ZRS(cC stj|d�dS(NR�(R�R<(R;((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR<�s(RQRRR<(((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR��stNegFilcB seZd�ZRS(cC stj|d�dS(NR�(R�R<(R;((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR<�s(RQRRR<(((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR��stNegFillcB seZd�ZRS(cC stj|d�dS(NR�(R�R<(R;((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR<�s(RQRRR<(((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR��stNegFilllcB seZd�ZRS(cC stj|d�dS(NR�(R�R<(R;((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR<�s(RQRRR<(((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR��stSsGluecB seZd�ZRS(cC stj|d�dS(NR�(R�R<(R;((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR<�s(RQRRR<(((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR��st HCenteredcB seZdZd�ZRS(ss A convenience class to create an :class:`Hlist` whose contents are centered within its enclosing box. cC s.tj|t�g|t�gdt�dS(NR|(RyR<R�R(R;Rq((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR<�s#(RQRRRSR<(((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR��st VCenteredcB seZdZd�ZRS(sr A convenience class to create a :class:`Vlist` whose contents are centered within its enclosing box. cC s(tj|t�g|t�g�dS(N(R�R<R�(R;Rq((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR<s(RQRRRSR<(((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR��sR}cB s2eZdZd�Zd�Zd�Zd�ZRS(s� A :class:`Kern` node has a width field to specify a (normally negative) amount of spacing. This spacing correction appears in horizontal lists between letters like A and V when the font designer said that it looks better to move them closer together or further apart. A kern node can also appear in a vertical list, when its *width* denotes additional spacing in the vertical direction. cC stj|�||_dS(N(RSR<R=(R;R=((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR< s cC s d|jS(Nsk%.02f(R=(R;((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR�scC s2tj|�|jtkr.|jt9_ndS(N(RSRXRTR\R=R](R;((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyRXs cC s tj|�|jt9_dS(N(RSRYR=R^(R;((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyRYs (RQRRRSR<R�RXRY(((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR}s     tSubSuperClustercB seZdZd�ZRS(sR :class:`SubSuperCluster` is a sort of hack to get around that fact that this code do a two-pass parse like TeX. This lets us store enough information in the hlist itself, namely the nucleus, sub- and super-script, such that if another script follows that needs to be attached, it can be reconfigured on the fly. cC s/d|_d|_d|_tj|g�dS(N(R9tnucleustsubtsuperRyR<(R;((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR<%s   (RQRRRSR<(((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR�stAutoHeightCharcB seZdZed�ZRS(sG :class:`AutoHeightChar` will create a character as close to the given height and depth as possible. When using a font with multiple height versions of some characters (such as the BaKoMa fonts), the correct glyph will be selected, otherwise this will always just return a scaled version of the glyph. c C s�|jj|j|�}|j�}||}xF|D]>\}} ||_t| |�} | j| j|kr5Pq5q5W|| j| j} |j| 9_t| |�} || j} tj || g�| |_ dS(N( RbR�RgR�RaR>R?RxRyR<Rl( R;RR>R?RetalwaysR4t target_totalR�R�tchartfactortshift((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR<3s     (RQRRRSRR<(((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR�+st AutoWidthCharcB seZdZeed�ZRS(s: :class:`AutoWidthChar` will create a character as close to the given width as possible. When using a font with multiple width versions of some characters (such as the BaKoMa fonts), the correct glyph will be selected, otherwise this will always just return a scaled version of the glyph. c C s�|jj|j|�}|j�}x?|D]7\}}||_|||�} | j|kr+Pq+q+W|| j} |j| 9_|||�} tj|| g�| j|_dS(N(RbR�RgR�R=RxRyR<( R;RR=ReR�t char_classR4R�R�R�R�((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR<Os    (RQRRRSRRaR<(((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR�GstShipcB s>eZdZd�Zd�Zee�Zd�Zd�ZRS(s� Once the boxes have been set up, this sends them to output. Since boxes can be inside of boxes inside of boxes, the main work of :class:`Ship` is done by two mutually recursive routines, :meth:`hlist_out` and :meth:`vlist_out`, which traverse the :class:`Hlist` nodes and :class:`Vlist` nodes inside of horizontal and vertical boxes. The global variables used in TeX to store state as it processes have become member variables here. cC sNd|_d|_d|_d|_||_||j|_|j|�dS(Nig(tmax_pushtcur_stcur_vtcur_htoff_hR>toff_vt hlist_out(R;RERFRN((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyt__call__ks     cC s$|dkrdS|dkr dS|S(Nge��ge��A((tvalue((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pytclampts   cC s/d}d}|j}|j}|j}|j}|jd7_t|j|j�|_|j}x�|jD]�} t | t �r�| j |j|j |j|j �|j| j7_qjt | t�r�|j| j7_qjt | t�rvt| j�dkr|j| j7_q|j} || j|_t | t�rM|j| �n |j| �| | j|_||_qjt | t�r=| j} | j} | j} t| �r�|j} nt| �r�|j} n| dkr+| dkr+t| |_| j |j|j |j|j | | �t|_n|j| 7_qjt | t�rj| j}|j|} |dkr�|dkr�|j|kr�||j7}t|t |j!�|��}q�q�|j"|kr�||j#7}t|t |j!�|��}q�n| |7} |j| 7_qjqjW|jd8_dS(Nigi($RpRoR�R�R�RXR�R�RmRRaRZR�R�R=R}RkR�RlRyR�t vlist_outR[R>R?RtbaselineR�R�R�R�troundR�RnR�RX(R;RNtcur_gtcur_glueRpRot base_linet left_edgeR�R�tedget rule_heightt rule_deptht rule_widthR�((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR�|sl     $                   % % cC sd}d}|j}|j}|jd7_t|j|j�|_|j}|j|j8_|j}|j}x�|j D]�} t | t �r�|j| j 7_q|t | t �ret| j �dkr�|j| j| j7_q|j| j7_|| j|_|j} |j | _ t | t�r<|j| �n |j| �| | j|_||_q|t | t�r| j} | j} | j } t| �r�|j } n| | 7} | dkr| dkr|j| 7_| j|j|j|j|j| | �qq|t | t�r�| j}|j |} |dkr�|dkr�|j|kr�||j7}t|t|j�|��}q�q�|j |kr�||j!7}t|t|j�|��}q�n| |7} |j| 7_q|t | t"�r|t#d��q|q|W|jd8_dS(Nigis1Internal mathtext error: Char node found in vlist($RpRoR�RXR�R�R�R>R�RmRR}R=RkR�R?RlRyR�R�R[RRZR�R�R�R�R�R�R�R�RnR�RXRaR�(R;RNR�R�RpRoR�ttop_edgeR�R�tsave_vR�R�R�R�((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR��sj                     % % (RQRRRSR�R�t staticmethodR�R�(((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR�as     ?c s)�fd�}t�}|j|�|S(s. Helper class to raise parser errors. c st�d|��dS(Ns (R(R�tlocttoks(tmsg(sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyt raise_error�s(RtsetParseAction(R�R�R�((R�sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pytError�s  tParsercB seZdZedj��Zedj��Zedj��ZeeBeBZedj��Z edj��Z edj��Z edj��Z edj��Z ed j��Zed j��Zed j��Zed j��Zd �Zd�Zd�Zdefd��YZd�Zd�Zd�Zd�Zd�Zd�Zd�Zidd6dd6dd6dd 6d!d"6d#d$6dd%6Zd&�Zd'�Z d(�Z!id`dbd.fd/6Z#d0�Z$id1d26d3d46d5d66d7d86d9d:6d;d<6d=d>6d?d@6dAdB6d;dC6d7dD6d9dE6d=dF6d?dG6d1dH6dIdJ6dKdL6Z%edMj��Z&dN�Z'dO�Z(dP�Z)dQ�Z*dR�Z+dS�Z,dT�Z-dU�Z.dV�Z/dW�Z0dX�Z1dY�Z2dZ�Z3d[�Z4d\�Z5d]�Z6d^�Z7d_�Z8RS(cs This is the pyparsing-based parser for math expressions. It actually parses full strings *containing* math expressions, in that raw text may also appear outside of pairs of ``$``. The grammar is based directly on that in TeX, though it cuts a few corners. s� + * \pm \sqcap \rhd \mp \sqcup \unlhd \times \vee \unrhd \div \wedge \oplus \ast \setminus \ominus \star \wr \otimes \circ \diamond \oslash \bullet \bigtriangleup \odot \cdot \bigtriangledown \bigcirc \cap \triangleleft \dagger \cup \triangleright \ddagger \uplus \lhd \amalgsc = < > : \leq \geq \equiv \models \prec \succ \sim \perp \preceq \succeq \simeq \mid \ll \gg \asymp \parallel \subset \supset \approx \bowtie \subseteq \supseteq \cong \Join \sqsubset \sqsupset \neq \smile \sqsubseteq \sqsupseteq \doteq \frown \in \ni \propto \vdash \dashv \dotss� \leftarrow \longleftarrow \uparrow \Leftarrow \Longleftarrow \Uparrow \rightarrow \longrightarrow \downarrow \Rightarrow \Longrightarrow \Downarrow \leftrightarrow \longleftrightarrow \updownarrow \Leftrightarrow \Longleftrightarrow \Updownarrow \mapsto \longmapsto \nearrow \hookleftarrow \hookrightarrow \searrow \leftharpoonup \rightharpoonup \swarrow \leftharpoondown \rightharpoondown \nwarrow \rightleftharpoons \leadstos, ; . ! \ldotp \cdotps} \sum \prod \coprod \bigcap \bigcup \bigsqcup \bigvee \bigwedge \bigodot \bigotimes \bigoplus \biguplus slim liminf limsup sup max mins \int \oints6rm cal it tt sf bf default bb frak circled scr regulars� arccos csc ker min arcsin deg lg Pr arctan det lim sec arg dim liminf sin cos exp limsup sinh cosh gcd ln sup cot hom log tan coth inf max tanhsb | \| / \backslash \uparrow \downarrow \updownarrow \Uparrow \Downarrow \Updownarrow .s( [ { < \lfloor \langle \lceils) ] } > \rfloor \rangle \rceilc% C sEt�j|j�jd�}t�}t�j|j�jd�}t�jd�}t�jd�}t�j|j�}t�j|j�jd�|_td�}t d�j �}t d�j �} t |�|} | j|j �| j �} | j|j�t d �} t|jj�t|j��} tt|j��}tt|j��}tg|jD]}d |^qp�}t| �td d d ddddg�j|j�jd�}t d�||| td�Bj|j�jd�}d}td|�t| ttj���ttd��Bj|j�j�}t| �t|jj��j|j �}t!t| �| |�j|j"�jd�} t| �|j|j#�jd�}t!| t$||A�| �j|j%�jd�}|t| �|>|t| �|>t!tt d��||td�B�j|j&�jd�}t!tt d��||td �B�j|j'�jd!�}t!tt d"��||td#�B�j|j(�jd$�}tt|j)��}tt|j*��}tt|j+��}tt|j+t,dg���}t!tt d%��tt d��tt|j)|j*Bt,d&g�B��tt d��tt d��tt|j)|j+t,dg�Bt,d&d'g�B��tt d��tt d��td(�tt d��|||td)�B�j|j-�jd*�}t!tt d+��t tt d,��td-�tt d.��d/d�|td0�B�j|j/�jd1�} ||||BA| A|A|A|A|A|A| A>|||B|B|B>td2d3g�}!|t!t |�t0|!|�|B�>|tt d4��||Btd5�Bt!t0||A��tt d6��||Btd5�B>t0||A�j|j1�jd �}"| t d7�}#td8�j|j2�jd9�j�}$|j|$t$t|#�t |"�t|#�td:�B|$�t3�>|j4�dS(;NRgtsubsupert placeabletsimpletfinishs[-+]?([0-9]+\.?[0-9]*|\.[0-9]+)R�R�s\tmaths\ s\/s\,s\;s\quads\qquads\!tspaces\hspacesExpected \hspace{n}t customspaceu€-🿿u8([a-zA-Z0-9 +\-*/<>=:,.;!'@()\[\]|%s])|(\\[%%${}\[\]_|])s [^a-zA-Z]taccenttfunctiontgroups\fracsExpected \frac{num}{den}tfracs \stackrelsExpected \stackrel{num}{den}tstackrels\binomsExpected \binom{num}{den}tbinoms\genfracts\}s[0-9]*(\.?[0-9]*)?s<Expected \genfrac{ldelim}{rdelim}{rulesize}{style}{num}{den}tgenfracs\sqrtR�s[0-9]+R�R�sExpected \sqrt{value}tsqrtt_t^s\leftsExpected a delimiters\rightt$s(?:(?:\\[$])|[^$])*tnon_mathsExpected end of math '$'(5R R�RgtsetNametsubsuperscripttauto_sized_delimiterR�t _expressionRR tsuppressR t start_groupR�t end_groupRt _accent_maptkeystlistt _wide_accentst_function_namest _fontnamesRR�R�R�RR&R2tleaveWhitespaceRt_char_over_charstchar_over_charsRR�R�R R�R�R�R�t _ambiDelimt _leftDelimt _rightDelimR�R�R9R�R R�R�Rtclear(%R;Rgt latexfontR�R�R�t autoDelimR�tlbracetrbraceR�R�tbslashR�R�R�R�t latex2efontR�R�t unicode_rangeR2tc_over_cR�R�R�R�t ambiDelimt leftDelimt rightDelimtrightDelimSafeR�R�t subsuperopR�t math_delimR�((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR<Ts� !   &          " �Y)  Y  / cC sd|_d|_i|_dS(s1 Clear any state before parsing. N(R9t_exprt _state_stackt_em_width_cache(R;((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR s  cC s�|j|dd||�g|_y|jj|�WnLtk r�}tdjd|jd|jddt |�g���nX|j S(s� Parse expression *s* using the given *fonts_object* for output, at the given *fontsize* and *dpi*. Returns the parse tree of :class:`Node` instances. R�R�s R�RfiR�( tStateRR�t parseStringRR1RHtlinetcolumnR�R(R;R�R:RxR�terr((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pytparse s! RcB sAeZdZd�Zd�Zd�Zd�Zeee�ZRS(s� Stores the state of the parser. States are pushed and popped from a stack as necessary, and the "current" state is always at the top of the stack. cC s1||_||_||_||_||_dS(N(Rbt_fontR�RxR�(R;RbRgR�RxR�((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR<= s     cC s(tj|j|j|j|j|j�S(N(R�RRbRgR�RxR�(R;((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR�D s cC s|jS(N(R(R;((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR�L scC s%|dkr||_n||_dS(NR�R�R�(srmsitsbf(R�R(R;R((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyt _set_fontN s  ( RQRRRSR<R�R�RtpropertyRg(((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR6 s     cC s |jdS(s? Get the current :class:`State` of the parser. i����(R(R;((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyt get_stateT scC s|jj�dS(s8 Pop a :class:`State` off of the stack. N(Rtpop(R;((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyt pop_stateZ scC s |jj|j�j��dS(sm Push a new :class:`State` onto the stack which is just a copy of the current state. N(RR�RR�(R;((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyt push_state` scC st|�|_|jgS(N(RyR(R;R�R�R�((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR�g scC st|�}|j�|gS(N(RyR(R;R�R�R�thlist((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR�l s  cC sn|djdd�}g|D]}t||j��^q}t|�}|j�td|j�_|gS(Nis\$R�smathtext.default(treplaceRaRRyRR*Rg(R;R�R�R�RtsymbolsR ((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR�r s (  cC s�|j�}|j|j|jf}|jj|�}|dkr�|jj|jt dd|j|j�}|j }||j|<nt ||�S(Nsmathtext.defaultR�( RRgRxR�RR�R9RbR�R*R�R}(R;t percentageReR�R=RZ((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyt _make_space| s   " g333333�?s\ g�������?s\,g�������?s\;g�������?s\quadg������ @s\qquadg������ٿs\!s\/cC s?t|�dkst�|j|d}|j|�}|gS(Nii(R�Rct _space_widthsR$(R;R�R�R�R�RN((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR�� scC s|jt|d��gS(Ni(R$R�(R;R�R�R�((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR�� scC s�|d}yt||j��}Wn!tk rFtd|��nX||jkr�t|jd�||jd�gdt�gS||jkr�t||jd�gdt�gS|gS(NisUnknown symbol: %sg�������?R|( RaRR1Rt_spaced_symbolsRyR$Rt_punctuation_symbols(R;R�R�R�RR�((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR2� s    R�tAg�?s\circg�?gtAAcC s�|d}|j�}|jj|j|j|j�}|jj|d�\}}} |dkrpt d��n|j �} |ddk r�|d| _n| j|d9_t |d| �} |j �} |ddk r�|d| _n| j|d9_t |d| �} t | j| j�}t| g�}|j|d�t| g�}|j|d�t|td|| �|g�S(NigsError parsing symboliitexactly(NNg(RRbR�RgRxR�R�R�R9RR�RjRaRXR=R�R{R�R_(R;R�R�R�R�ReR�t under_desct over_descR�t over_statetovert under_statetunderR=t over_centeredtunder_centered((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR�� s4      s\circumflexaccentthats\combiningbrevetbreves\combiningoverlinetbars\combininggraveaccenttgraves\combiningacuteaccenttacutes\combiningdiaeresistddots\combiningtildettildes\combiningdotabovetdots\combiningrightarrowabovetvect"t`t't~t.R�s \rightarrowtoverrightarrows \leftarrowt overleftarrowswidehat widetilde widebarc C s t|�dkst�|j�}|jj|j|j|j�}t|d�dkrjtd��n|d\}}||j kr�t d||j |dt �}nt |j ||�}t|g�}|j|j d�t|td|d �t|g�g�S( NiiisError parsing accents\R�R*gg@(R�RcRRbR�RgRxR�RR�R�R=RjR�R�R{R�R_Ry( R;R�R�R�ReR�R�R�tcentered((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR�� s"  cC sf|j�|j�}d|_tg|dD]}t||�^q-�}|j�|d|_|S(NR�i(RRRgRyRaRt function_name(R;R�R�R�ReRR ((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR� s   ,  cC s4|j�t|�r0|dd|j�_ngS(Nii(RR�RRg(R;R�R�R�((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR� s  cC st|d�}|gS(Ni(Ry(R;R�R�R�tgrp((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR� scC s|j�gS(N(R(R;R�R�R�((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR� s cC s5t|�dkst�|d}||j�_gS(Nii(R�RcRRg(R;R�R�R�R((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyRg s cC sQt|t�r|j|jkSt|t�rMt|d�rM|j|jkStS(NRD( RRaRt_overunder_symbolsRythasattrRDt_overunder_functionsR(R;R�((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyt is_overunder! s cC s#t|t�r|j|jkStS(N(RRaRt_dropsub_symbolsR(R;R�((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyt is_dropsub( scC st|t�r|j�StS(N(RRaRhR(R;R�((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyRh- s cC sLt|�dkst�d}d}d}t|d�dkrN|dj�St|d�dkr�|d\}}td�}|dkr�|}q�|}n�t|d�dkr�|d\}}}|dkr�|}q�|}n�t|d�dkrt|d\}} } } } | | krJ| dkr;td��qJtd ��n| dkre| }| }q�| }| }n td ��|j�} | jj| j | j | j �}| jj | j | j | j �}|j |�rEg}d}|j}|dk r|j�t||j�}n|dk rH|j�t||j�}n|dk r�t|g�}|j|d �|j|t|d �g�nt|g�}|j|d �|j|�|dk rt|g�}|j|d �|jt|d �|g�|j}nt|�}||j|_t|g�}|gS|jt|}|j|�ry|jt|}n t|}|dkr�|j�t|g�}t|t�}|jt|d �d}t||�}||_nF|j�t|tt|�g�}t |}t||�}|jt|�d }t||�}|dkrk| |_n�|j�t|g�}t|t|�}d|||j|j|}|dkr�||7}||7}n|j!|�r�t"|||_nt|t||j|j|�|g�}||_t||g�}|gS(NiiigR�iisDouble subscriptsDouble superscriptsOSubscript/superscript sequence is too long. Use braces { } to remove ambiguity.R*g@g@g@g@(#R�RcR9tasListR`RRRbR�RgRxR�R�RIR=RXRXR�R{textendR}R�R>R�R?RlRytSUBDROPRKtSUB1tabst SCRIPT_SPACEtSUP1RhtDELTA(R;R�R�R�R�R�R�topRWtop1tnext1top2tnext2Retrule_thicknessR�tvlistR�R=R R�tshift_upt shift_downR�tclrRn((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR�2 s�                                         cC s�|j�}|jj|j|j|j�}t|�}|j�|j�t|g�} t|g�} t |j |j �} | j | d�| j | d�t | t d|d�t||�t d|d�| g�} |jj|jtdd|j|j�} | j| j| jd|d}|| _t| t|d�g�g}|s`|r�|dkrud }n|dkr�d }n|d kr�d }n|j|||�S|S( NR*ig@smathtext.defaultt=ig@R�R@s\}R�(RRbR�RgRxR�R�RXR�RXR=R{R�R_R�R�R*R>R\R^RlRyR`t_auto_sized_delimiter(R;tldelimtrdelimtruletstyleR�tdenReR�tcnumtcdenR=RZRZR�R�((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyt_genfrac� sB                  cC sKt|�dkst�t|d�dks4t�|jt|d��S(Niii(R�RcRgttuple(R;R�R�R�((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR�� scC s�t|�dkst�t|d�dks4t�|j�}|jj|j|j|j�}|d\}}|jdd|d||�S(NiiiR�( R�RcRRbR�RgRxR�Rg(R;R�R�R�ReR�R�Rd((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR�� s  cC s`t|�dkst�t|d�dks4t�|d\}}|jdddd||�S(NiiiR�g(R�RcRg(R;R�R�R�R�Rd((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR�� scC s`t|�dkst�t|d�dks4t�|d\}}|jdddd||�S(NiiiR�R�gR�(R�RcRg(R;R�R�R�R�Rd((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR�� scC s�|d\}}|j�}|jj|j|j|j�}|j|j|d}|j|j} t d|| |dt �} | j| j}| j| j} t t |d�|t |d�g�} t t|�t�| g�} | j||j|jd | d�|dkr4t| jd d d �}n<t g|D]} t| |�^q>�}|j�|j�t t |g�g�}| d |_t |t| j d �| | g�}|gS( Nig@s \__sqrt__R�g@gY@g(@R*g�?gg333333�?g��@(RRbR�RgRxR�R>RlR?R�RRyR`R�R�R�R�R9R[R=RaRXR}(R;R�R�R�troottbodyReR�R>R?tcheckt padded_bodyt rightsideR�t root_vlistR ((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR�� s:      (   c C s�|j�}tg|D]}|j^q�}tg|D]}|j^q8�}g}|dkr�|jt||||��n|j|�|dkr�|jt||||��nt|�} | S(NR@(RRXR>R?R�R�RMRy( R;tfronttmiddletbackReR�R>R?tpartsR ((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR_ s ""    cC s(|\}}}|j||j�|�S(N(R_RL(R;R�R�R�RoRpRq((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR�/ s(srmR(g�?N(Ns\circg�?(9RQRRRSR�Rt_binary_operatorst_relation_symbolst_arrow_symbolsR&R'RFRHRJR�R�R�R�RR<RRtobjectRRRRR�R�R�R$R%R�R�R2R9R�R�R�R�R�R�R�R�R�RgRIRKRhR�RgR�R�R�R�R�R_R�(((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR�s�    �             %          y )    - tMathTextParsercB s�eZdZied6ed6ed6ed6ed6e d6e d6ed6Z ie d6e d 6ed 6ed 6Zd �Zd dd�Zddd�Zdddd�Zdddd�Zddd�ZRS(tbitmaptaggR{tpdftsvgRGtcairotmacosxtcmtstixtstixsanstcustomcC s"|j�|_td�|_dS(sI Create a MathTextParser for the given backend *output*. i2N(R�t_outputRt_cache(R;toutput((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyR<O siHc C s�|dkrt�}n||t|�f}|jj|�}|dk rO|S|jdkrwtdrwt|�}n_|j|j�}td}|j j|j ��} | dk r�| ||�}n t d��|j �} |j dkrt�|j_ n|j j||| |�} |j| j| j| j�|j| �}||j|<|j j�|j�d|j_d|_|S(s� Parse the given math expression *s* at the given *dpi*. If *prop* is provided, it is a :class:`~matplotlib.font_manager.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 :meth:`parse` with the same expression should be fast. R{s ps.useafmsmathtext.fontsetsEmathtext.fontset must be either 'cm', 'stix', 'stixsans', or 'custom'N(R9R#thashR�R�R�R*R7t_backend_mappingt_font_type_mappingR�R1tget_size_in_pointst_parserR�RVRRCR=R>R?RORR�RdR:( R;R�R�R tcacheKeyR�Rbtbackendtfontsett fontset_classRxRN((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyRV s6            ixicC s[|jdkst�td|�}|j|d|d|�\}}|j�}||fS(s� *texstr* A valid mathtext string, eg r'IQ: $\sigma_i=15$' *dpi* The dots-per-inch to render the text *fontsize* The font size in points Returns a tuple (*array*, *depth*) - *array* is an NxM uint8 alpha ubyte mask array of rasterized tex. - depth is the offset of the baseline from the bottom of the image in pixels. RxRTR�R (R�RcR#Rtas_array(R;ttexstrR�RxR tftimageR?R�((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pytto_mask� s ! tblackc C s|j|d|d|�\}}tjj|�\}}} tj|jd|jddfdtj�} td|�| dd�dd�df<td|�| dd�dd�df<td| �| dd�dd�d f<|| dd�dd�d f<| |fS( s� *texstr* A valid mathtext string, eg r'IQ: $\sigma_i=15$' *color* Any matplotlib color argument *dpi* The dots-per-inch to render the text *fontsize* The font size in points Returns a tuple (*array*, *depth*) - *array* is an NxM uint8 alpha ubyte mask array of rasterized tex. - depth is the offset of the baseline from the bottom of the image in pixels. R�Rxiiitdtypei�Nii( R�tmcolorstcolorConvertertto_rgbtnptzerostshapetuint8Rk( R;R�tcolorR�RxR�R?R�RR�tRGBA((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pytto_rgba� s!/)))c C sY|j|d|d|d|�\}}|j\}} } tj|j�| ||�|S(s8 Writes a tex expression to a PNG file. Returns the offset of the baseline from the bottom of the image in pixels. *filename* A writable filename or fileobject *texstr* A valid mathtext string, eg r'IQ: $\sigma_i=15$' *color* A valid matplotlib color argument *dpi* The dots-per-inch to render the text *fontsize* The font size in points Returns the offset of the baseline from the bottom of the image in pixels. R�R�Rx(R�R�t_pngt write_pngttostring( R;R�R�R�R�RxtrgbaR?tnumrowstnumcolsttmp((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pytto_png� s'cC sI|jdkst�td|�}|j|d|d|�\}}|S(s+ Returns the offset of the baseline from the bottom of the image in pixels. *texstr* A valid mathtext string, eg r'IQ: $\sigma_i=15$' *dpi* The dots-per-inch to render the text *fontsize* The font size in points RxRTR�R (R�RcR#R(R;R�R�RxR R�R?((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyt get_depth� s!N(RQRRR9R�RrRpRsR|R�R�R�R�R�R�R6R R�R<RR�R�R�R�(((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyRw: s*   4 (�RSt __future__RRFt cStringIORR�RR�t NameErrortsetsRRtwarningsRtnumpyRRR�t pyparsingRRR R R R R RRRRRRRRRRt enablePackrattmatplotlib.afmRtmatplotlib.cbookRRRRtmatplotlib.ft2fontRRRR R!tmatplotlib.font_managerR"R#tmatplotlib._mathtext_dataR$R%R&R'R(t matplotlibR)R*tmatplotlib.colorstcolorsR�tmatplotlib._pngR�R4R7RvR8RTReRpRqRrRsR|R�R�R�R�R�R�R R�R6R7R]R^R\RQRNRRRORStWarningRRSR[R_R`RaRjRkRyR�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R}R�R�R�R�R`R�R�Rw(((sF/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/mathtext.pyt<module>s�    p "((  41+  )�vsnq� !N=oJ  ! �  ���8