
 m[c           @` s8  d  Z  d d l m Z m Z m Z m Z d d l Z d d l m Z d d l Z d d l	 m
 Z
 d d l Z d d l m Z d d l m Z m Z d d l Z d d l m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z m  Z  m! Z! m" Z" m# Z# e j$   d d	 l% m& Z& m' Z( m) Z) m* Z* d d
 l+ m, Z, d d l- m. Z. m/ Z/ m0 Z0 d d l1 m2 Z2 m3 Z3 m4 Z4 d d l5 m6 Z6 m7 Z7 m8 Z8 d d l9 m: Z: m; Z; m< Z< m= Z= m> Z> e? d  Z@ d   ZA d eB f d     YZC d eC f d     YZD d eD f d     YZE d eC f d     YZF d eC f d     YZG d eC f d     YZH d eC f d     YZI d eC f d      YZJ d! eB f d"     YZK d# eK f d$     YZL d% eL f d&     YZM d' eL f d(     YZN d) eN f d*     YZO d+ eO f d,     YZP d- eO f d.     YZQ d/ eN f d0     YZR d1 eR f d2     YZS d3 eK f d4     YZT d5 ZU d6 eU ZV d7 ZW d8 eB f d9     YZX d: eX f d;     YZY d< eX f d=     YZZ d> eX f d?     YZ[ d@ eX f dA     YZ\ dB eX f dC     YZ] i e] dD 6e] dE 6e\ dF 6eY dG 6eY dH 6eY dI 6eY dJ 6eY dK 6eY dL 6eY dM 6eZ dN 6eZ dO 6eZ dP 6eZ dQ 6eZ dR 6eZ dS 6eZ dT 6e] dU 6e] dV 6Z^ dW   Z_ dX e` f dY     YZa dZ eB f d[     YZb d\ eb f d]     YZc d^ ec f d_     YZd d` ec f da     YZe db eb f dc     YZf dd ef f de     YZg df ec f dg     YZh dh eh f di     YZi dj eh f dk     YZj dl ec f dm     YZk dn ek f do     YZl dp ek f dq     YZm dr eb f ds     YZn dt eB f du     YZo i eo dv d6 dw dv d  dx 6eo dv d6 dy dv d  dz 6eo dv d6 d{ dv d  d| 6eo dv dv d d6 dw  d} 6eo dv dv d d6 dy  d~ 6eo dv dv d d6 d{  d 6eo dv dv d dv d  d 6eo dv d6 dw d dw  d 6eo _p d en f d     YZq d en f d     YZr d en f d     YZs d en f d     YZt d en f d     YZu d en f d     YZv d en f d     YZw d ei f d     YZx d ei f d     YZy d eb f d     YZz d ei f d     YZ{ d ei f d     YZ| d ei f d     YZ} d eB f d     YZ~ e~   Z d   Z d eB f d     YZ d eB f d     YZ e e e d  Z d S(   uK  
: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 :doc:`/tutorials/text/mathtext`.  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.
i    (   t   absolute_importt   divisiont   print_functiont   unicode_literalsN(   t   unichr(   t   ceil(   t   warn(   t   inft   isinf(   t   Combinet   Emptyt
   FollowedByt   Forwardt   Groupt   Literalt   oneOft	   OneOrMoret   Optionalt   ParseBaseExceptiont   ParseFatalExceptiont   ParserElementt   QuotedStringt   Regext	   StringEndt   Suppresst
   ZeroOrMore(   t   _pngt   colorst   get_data_patht   rcParams(   t   AFM(   t   Buncht   get_realpath_and_statt   maxdict(   t   FT2Imaget   KERNING_DEFAULTt   LOAD_NO_HINTING(   t   findfontt   FontPropertiest   get_font(   t   latex_to_bakomat   latex_to_standardt   tex2unit   latex_to_cmext   stix_virtual_fontsc         C` s   | s t  |   S|  d k r  d Sy t  |   SWn t k
 rA n Xy t |  j d  SWn* t k
 r d t   } t |   n Xd S(   u'  get_unicode_index(symbol, [bool]) -> 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').
If math is False, the current symbol should be treated as a non-math symbol.
u   -i"  u   \uA   '%(symbol)s' is not a valid Unicode character or
TeX/Type1 symbolN(   t   ordt	   TypeErrorR*   t   stript   KeyErrort   localst
   ValueError(   t   symbolt   matht   message(    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyt   get_unicode_index6   s    	
c         C` s-   y t  |   SWn t k
 r( t  d  SXd S(   u   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(   R   R2   (   t   index(    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyt   unichr_safeS   s    t   MathtextBackendc           B` sD   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   u  
    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_rect_filled`
      - :meth:`get_results`

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

      - :meth:`get_hinting_type`
    c         C` s   d |  _  d |  _ d |  _ d  S(   Ni    (   t   widtht   heightt   depth(   t   self(    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyt   __init__l   s    		c         C` s   | |  _  | |  _ | |  _ d S(   u   Dimension the drawing canvasN(   R:   R;   R<   (   R=   t   wt   ht   d(    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyt   set_canvas_sizeq   s    		c         C` s   t     d S(   u_   
        Draw a glyph described by *info* to the reference point (*ox*,
        *oy*).
        N(   t   NotImplementedError(   R=   t   oxt   oyt   info(    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyt   render_glyphw   s    c         C` s   t     d S(   uR   
        Draw a filled black rectangle from (*x1*, *y1*) to (*x2*, *y2*).
        N(   RC   (   R=   t   x1t   y1t   x2t   y2(    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyt   render_rect_filled~   s    c         C` s   t     d S(   up   
        Return a backend-specific tuple to return to the backend after
        all processing is done.
        N(   RC   (   R=   t   box(    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyt   get_results   s    c         C` s   t  S(   u\   
        Get the FreeType hinting type to use with this particular
        backend.
        (   R$   (   R=   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyt   get_hinting_type   s    (	   t   __name__t
   __module__t   __doc__R>   RB   RG   RL   RN   RO   (    (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR9   \   s   					t   MathtextBackendAggc           B` sM   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 RS(   u   
    Render glyphs and rectangles to an FTImage buffer, which is later
    transferred to the Agg image by the Agg backend.
    c         C` sJ   d |  _  d |  _ d  |  _ d |  _ d d d d g |  _ t j |   d  S(   Ni    u   bbox(   RD   RE   t   Nonet   imaget   modet   bboxR9   R>   (   R=   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR>      s    				c         C` sY   t  |  j d |  t  |  j d |  t |  j d |  t |  j d |  g |  _ d  S(   Ni    i   i   i   (   t   minRW   t   max(   R=   RH   RI   RJ   RK   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyt   _update_bbox   s    c         C` sW   t  j |  | | |  |  j d k rS t t |  t | t | d    |  _ n  d  S(   Nu   bboxi    (   R9   RB   RV   R"   R   RY   RU   (   R=   R?   R@   RA   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyRB      s    c         C` s   |  j  d k rP |  j | | j j | | j j | | j j | | j j  n3 | j j |  j	 | | | j j
 | j d t d d  S(   Nu   bboxt   antialiasedu   text.antialiased(   RV   RZ   t   metricst   xmint   ymaxt   xmaxt   ymint   fontt   draw_glyph_to_bitmapRU   t   icebergt   glyphR   (   R=   RD   RE   RF   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyRG      s    	c         C` s   |  j  d k r( |  j | | | |  n t t | |  d d  } | d k rz | | d } t | | d d  } n t |  } |  j j t |  | t |  | |  d  S(   Nu   bboxi   i    g       @(   RV   RZ   RY   t   intRU   t   draw_rect_filledR   (   R=   RH   RI   RJ   RK   R;   t   centert   y(    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyRL      s    c         C` s	  d |  _  | j } | j } t d d |  |  j } | d d | d d | d d | d d g } d |  _  |  j | d | d | d | d | | d | d |  t | d | d |  |  j |  j |  j |  j |  j |  j |  j	 | f } d  |  _	 | S(   Nu   bboxi    i   i   i   u   render(   RV   R;   R<   t   shipRW   RB   RD   RE   R:   RU   RT   (   R=   RM   t   used_characterst   orig_heightt
   orig_depthRW   t   result(    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyRN      s*    				2			c         C` s   d d l  m } | j   S(   Ni    (   t   backend_agg(   t   matplotlib.backendsRn   t   get_hinting_flag(   R=   Rn   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyRO      s    (
   RP   RQ   RR   R>   RZ   RB   RG   RL   RN   RO   (    (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyRS      s   						t   MathtextBackendBitmapc           B` s   e  Z d    Z RS(   c   
      C` s4   t  j |  | |  \ } } } } } } }	 | | f S(   N(   RS   RN   (
   R=   RM   Rj   RD   RE   R:   R;   R<   RU   t
   characters(    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyRN      s    *(   RP   RQ   RN   (    (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyRq      s   t   MathtextBackendPsc           B` s2   e  Z d  Z d   Z d   Z d   Z d   Z RS(   uX   
    Store information to write a mathtext rendering to the PostScript
    backend.
    c         C` s   t  j j   |  _ d  |  _ d  S(   N(   t   sixt   movest	   cStringIOt   pswriterRT   t   lastfont(   R=   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR>      s    c         C` s   |  j  | | j } | j } | j } | j } | | f |  j k rs d t   } | | f |  _ |  j j |  n  d t   } |  j j |  d  S(   Nu=   /%(postscript_name)s findfont
%(fontsize)s scalefont
setfont
u1   %(ox)f %(oy)f moveto
/%(symbol_name)s glyphshow

(	   R;   t   offsett   postscript_namet   fontsizet   symbol_nameRx   R1   Rw   t   write(   R=   RD   RE   RF   Rz   R{   R|   t   ps(    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyRG      s    			c         C` s9   d | |  j  | | | | | f } |  j j |  d  S(   Nu   %f %f %f %f rectfill
(   R;   Rw   R}   (   R=   RH   RI   RJ   RK   R~   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyRL      s    %c         C` s6   t  d d |  |  j |  j |  j |  j |  j | f S(   Ni    (   Ri   R:   R;   R<   Rw   (   R=   RM   Rj   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyRN     s    (   RP   RQ   RR   R>   RG   RL   RN   (    (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyRs      s
   			t   MathtextBackendPdfc           B` s2   e  Z d  Z d   Z d   Z d   Z d   Z RS(   uQ   
    Store information to write a mathtext rendering to the PDF
    backend.
    c         C` s   g  |  _  g  |  _ d  S(   N(   t   glyphst   rects(   R=   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR>     s    	c         C` sO   | j  j } |  j | | j } |  j j | | | | j | j | j f  d  S(   N(	   Ra   t   fnameR;   Ry   R   t   appendR{   t   numR|   (   R=   RD   RE   RF   t   filename(    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyRG     s
    	c         C` s/   |  j  j | |  j | | | | | f  d  S(   N(   R   R   R;   (   R=   RH   RI   RJ   RK   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyRL     s    c         C` s<   t  d d |  |  j |  j |  j |  j |  j |  j | f S(   Ni    (   Ri   R:   R;   R<   R   R   (   R=   RM   Rj   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyRN     s    (   RP   RQ   RR   R>   RG   RL   RN   (    (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR   
  s
   			t   MathtextBackendSvgc           B` s2   e  Z d  Z d   Z d   Z d   Z d   Z RS(   uQ   
    Store information to write a mathtext rendering to the SVG
    backend.
    c         C` s   g  |  _  g  |  _ d  S(   N(   t
   svg_glyphst	   svg_rects(   R=   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR>   +  s    	c         C` sF   |  j  | | j } |  j j | j | j | j | | | j f  d  S(   N(   R;   Ry   R   R   Ra   R{   R   R\   (   R=   RD   RE   RF   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyRG   /  s    	c         C` s3   |  j  j | |  j | d | | | | f  d  S(   Ni   (   R   R   R;   (   R=   RH   RI   RJ   RK   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyRL   5  s    	c         C` sN   t  d d |  t d |  j d |  j  } |  j |  j |  j |  j | | f S(   Ni    R   R   (   Ri   R   R   R   R:   R;   R<   (   R=   RM   Rj   t   svg_elements(    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyRN   9  s    (   RP   RQ   RR   R>   RG   RL   RN   (    (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR   &  s
   			t   MathtextBackendPathc           B` s2   e  Z d  Z d   Z d   Z d   Z d   Z RS(   uY   
    Store information to write a mathtext rendering to the text path
    machinery.
    c         C` s   g  |  _  g  |  _ d  S(   N(   R   R   (   R=   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR>   I  s    	c         C` sF   |  j  | | j } | j } |  j j | j | j | | | f  d  S(   N(   R;   Ry   R   R   R   Ra   R{   (   R=   RD   RE   RF   t   thetext(    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyRG   M  s    		c         C` s/   |  j  j | |  j | | | | | f  d  S(   N(   R   R   R;   (   R=   RH   RI   RJ   RK   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyRL   S  s    	c         C` s9   t  d d |  |  j |  j |  j |  j |  j |  j f S(   Ni    (   Ri   R:   R;   R<   R   R   (   R=   RM   Rj   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyRN   W  s    (   RP   RQ   RR   R>   RG   RL   RN   (    (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR   C  s
   			t   MathtextBackendCairoc           B` s2   e  Z d  Z d   Z d   Z d   Z d   Z RS(   uS   
    Store information to write a mathtext rendering to the Cairo
    backend.
    c         C` s   g  |  _  g  |  _ d  S(   N(   R   R   (   R=   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR>   e  s    	c         C` sL   | | j  |  j } t | j  } |  j j | j | j | | | f  d  S(   N(   Ry   R;   R8   R   R   R   Ra   R{   (   R=   RD   RE   RF   R   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyRG   i  s    	c         C` s/   |  j  j | | |  j | | | | f  d  S(   N(   R   R   R;   (   R=   RH   RI   RJ   RK   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyRL   o  s    	c         C` s9   t  d d |  |  j |  j |  j |  j |  j |  j f S(   Ni    (   Ri   R:   R;   R<   R   R   (   R=   RM   Rj   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyRN   s  s    (   RP   RQ   RR   R>   RG   RL   RN   (    (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR   _  s
   			t   Fontsc           B` s}   e  Z d  Z d   Z d   Z d   Z e d  Z d   Z d   Z	 d   Z
 d   Z d	   Z d
   Z d   Z d   Z RS(   u   
    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.
    c         C` s   | |  _  | |  _ i  |  _ d S(   uH  
        *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(   t   default_font_propt   mathtext_backendRj   (   R=   R   R   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR>     s    
		c         C` s   d |  _ d S(   ua   
        Fix any cyclical references before the object is about
        to be destroyed.
        N(   RT   Rj   (   R=   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyt   destroy  s    c
   
      C` s   d S(   uv  
        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=   t   font1t
   fontclass1t   sym1t	   fontsize1t   font2t
   fontclass2t   sym2t	   fontsize2t   dpi(    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyt   get_kern  s    c         C` s%   |  j  | | | | | |  } | j S(   u4  
        *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

        *math*: whether sym is a math character

        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_infoR\   (   R=   Ra   t
   font_classt   symR{   R   R4   RF   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyt   get_metrics  s    c         C` sR   t  |  t  |  t  |  |  _ |  _ |  _ |  j j |  j |  j |  j  d S(   u   
        Set the size of the buffer used to render the math expression.
        Only really necessary for the bitmap backends.
        N(   R   R:   R;   R<   R   RB   (   R=   R?   R@   RA   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyRB     s    /c         C` s   |  j  | | | | |  } t | j j  \ }	 }
 |  j j |
 |	 t   f  } | d j | j  |  j	 j
 | | |  d S(   u  
        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.
        i   N(   R   R    Ra   R   Rj   t
   setdefaultt   sett   addR   R   RG   (   R=   RD   RE   t   facenameR   R   R{   R   RF   t   realpatht   stat_keyRj   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyRG     s    	c         C` s   |  j  j | | | |  d S(   uL   
        Draw a filled rectangle from (*x1*, *y1*) to (*x2*, *y2*).
        N(   R   RL   (   R=   RH   RI   RJ   RK   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyRL     s    c         C` s   t     d S(   uF   
        Get the xheight for the given *font* and *fontsize*.
        N(   RC   (   R=   Ra   R{   R   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyt   get_xheight  s    c         C` s   t     d S(   u   
        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(   RC   (   R=   Ra   R{   R   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyt   get_underline_thickness  s    c         C` s   |  j  S(   u   
        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.
        (   Rj   (   R=   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyt   get_used_characters  s    c         C` s)   |  j  j | |  j    } |  j   | S(   u   
        Get the data needed by the backend to render the math
        expression.  The return value is backend-specific.
        (   R   RN   R   R   (   R=   RM   Rm   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyRN     s    
c         C` s   | | f g S(   u  
        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=   t   fontnameR   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyt!   get_sized_alternatives_for_symbol  s    (   RP   RQ   RR   R>   R   R   t   TrueR   RB   RG   RL   R   R   R   RN   R   (    (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR   {  s   			!								t   TruetypeFontsc           B` sY   e  Z d  Z d   Z d   Z d   Z d   Z e d  Z d   Z	 d   Z
 d   Z RS(	   ua   
    A generic base class for all font setups that use Truetype fonts
    (through FT2Font).
    c         C` s[   t  j |  | |  i  |  _ i  |  _ t |  } t |  } | |  j d <| |  j d <d  S(   Nu   defaultu   regular(   R   R>   t   glyphdt   _fontsR%   R'   (   R=   R   R   R   t   default_font(    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR>     s    		c         C` s   d  |  _ t j |   d  S(   N(   RT   R   R   R   (   R=   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR   (  s    	c         C` s   | |  j  k r |  j  | } n | } |  j j |  } | d  k r t j j |  r t |  } | |  j | <| |  j | j <| |  j | j j	   <n  | S(   N(
   t   fontmapR   t   getRT   t   ost   patht   existsR'   Rz   t   lower(   R=   Ra   t   basenamet   cached_font(    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyt	   _get_font,  s    c         C` s2   | j  d k r. | j d d | d | d Sd S(   Nu   Cmex10g      P@g       @g      @g      R@g        (   Rz   R;   (   R=   Ra   Rd   R{   R   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyt   _get_offset9  s    c         C` s  | | | | | f } |  j  j |  } | d  k	 r7 | S|  j | | | | |  \ }	 }
 } } } |	 j | |  |	 j |
 d |  j j   } g  | j D] } | d ^ q \ } } } } |  j	 |	 | | |  } t
 d | j d d | j d d | j d d | d | d	 | | d
 | | d | j d | d |  	} t
 d |	 d | d |	 j d | d | d |
 d | d |  } |  j  | <| S(   Nt   flagsg      P@t   advanceg      @R;   R:   R]   R_   R`   R^   Rc   t   slantedRa   R{   Rz   R\   R|   R   Rd   Ry   (   R   R   RT   t
   _get_glypht   set_sizet	   load_charR   RO   RW   R   R   t   linearHoriAdvanceR;   R:   t   horiBearingYRz   (   R=   R   R   R   R{   R   R4   t   keyt   bunchRa   R   R|   R   Rd   t   valR]   R`   R_   R^   Ry   R\   Rm   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR   >  s>    *,

		c         C` s   |  j  |  } | j | |  | j d  } | d  k r` |  j | t d d | |  } | j S| d d | d | d } | S(   Nu   pcltu   mathtext.defaultu   xu   xHeightg      P@g      (@g      Y@(   R   R   t   get_sfnt_tableRT   R   R   Rc   (   R=   R   R{   R   Ra   t   pcltR\   t   xHeight(    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR   g  s    c         C` s   d | | d S(   Ng      ?g      (@g      R@g      ?(    (   R=   Ra   R{   R   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR   r  s    c
         C` s   | | k rt | | k rt |  j  | | | | |	  }
 |  j  | | | | |	  } |
 j } | j |
 j | j t  d St j |  | | | | | | | | |	 
 S(   Ng      P@(   R   Ra   t   get_kerningR   R#   R   R   (   R=   R   R   R   R   R   R   R   R   R   t   info1t   info2Ra   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR   x  s    	(   RP   RQ   RR   R>   R   R   R   R   R   R   R   R   (    (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR     s   	
			)		t   BakomaFontsc           B` s*  e  Z d  Z i d d 6d d 6d d 6d d 6d	 d
 6d d 6d d 6Z d   Z e d j    Z e d  Z	 i do dp dq dr ds g d 6dt du dv dw dx g d 6dy dz d{ d| d} g d 6d~ d d d d g d  6d d d d g d$ 6d d d d g d( 6d d d d g d0 6d d d d g d5 6d d d d g d: 6d d d d g d? 6d d d d g dD 6d d d d g dI 6d d d d g dN 6d d d d g dS 6d d d d d g dP 6d d d d g d\ 6d d d d g da 6d d g db 6d d g dc 6Z
 x@ d d d d d d d d d d g
 D] \ Z Z e
 e e
 e <qWdn   Z RS(   u   
    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.
    u   cmsy10u   calu   cmr10u   rmu   cmtt10u   ttu   cmmi10u   itu   cmb10u   bfu   cmss10u   sfu   cmex10u   exc         O` s{   t  | |   |  _ t j |  | |  i  |  _ xF t j |  j  D]2 \ } } t |  } | |  j | <| |  j | <qA Wd  S(   N(	   t	   StixFontst   _stix_fallbackR   R>   R   Rt   t	   iteritemst   _fontmapR%   (   R=   t   argst   kwargsR   R   t   fullpath(    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR>     s    	u
   \int \ointc         C` s&  d  } d  } | |  j k rd | t k rd t | \ } }	 | d k pO | |  j k }
 |  j |  } nK t |  d k r | d k }
 |  j |  } | d  k	 r t |  }	 q n  | d  k	 r | j |	  } | d k r | j |  } q n  | d  k r|  j	 j
 | | | | |  S| |	 | | |
 f S(   Nu   cmmi10i   u   iti    (   RT   R   R(   t   _slanted_symbolsR   t   lenR-   t   get_char_indext   get_glyph_nameR   R   (   R=   R   R   R   R{   R4   R|   Ra   R   R   R   t   gid(    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR     s&    	u   (u   ¡u   ³u   µu   Ãu   )u   ¢u   ´u   ¶u   !u   {u   ©u   nu   ½u   }u   ªu   ou   ¾u   [u   £u   hu   "u   ]u   ¤u   iu   #u   ¥u   ju   ¹u   $u   \lflooru   ¦u   ku   ºu   %u   \rflooru   §u   lu   »u   &u   \lceilu   ¨u   mu   ¼u   'u   \rceilu   ­u   Du   ¿u   *u   \langleu   ®u   Eu   Àu   +u   \rangleu   pu   qu   ru   su	   \__sqrt__u   ²u   /u   Âu   -u
   \backslashu   ±u   .u   Ëu   ,u   ^u   bu   cu   du   \widehatu   ~u   eu   fu   gu
   \widetildeu   <u   >u
   \leftparenu   \rightparentu
   \leftbraceu   \rightbraceu   \leftbracketu   \rightbracketu   \{u   \}u   \[u   \]c         C` s   |  j  j | | | f g  S(   N(   t   _size_alternativesR   (   R=   R   R   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR     s    (   u   rmu   ((   u   exu   ¡(   u   exu   ³(   u   exu   µ(   u   exu   Ã(   u   rmu   )(   u   exu   ¢(   u   exu   ´(   u   exu   ¶(   u   exu   !(   u   calu   {(   u   exu   ©(   u   exu   n(   u   exu   ½(   u   exu   ((   u   calu   }(   u   exu   ª(   u   exu   o(   u   exu   ¾(   u   exu   )(   u   rmu   [(   u   exu   £(   u   exu   h(   u   exu   "(   u   rmu   ](   u   exu   ¤(   u   exu   i(   u   exu   #(   u   exu   ¥(   u   exu   j(   u   exu   ¹(   u   exu   $(   u   exu   ¦(   u   exu   k(   u   exu   º(   u   exu   %(   u   exu   §(   u   exu   l(   u   exu   »(   u   exu   &(   u   exu   ¨(   u   exu   m(   u   exu   ¼(   u   exu   '(   u   exu   ­(   u   exu   D(   u   exu   ¿(   u   exu   *(   u   exu   ®(   u   exu   E(   u   exu   À(   u   exu   +(   u   exu   p(   u   exu   q(   u   exu   r(   u   exu   s(   u   exu   ²(   u   exu   /(   u   exu   Â(   u   exu   -(   u   rmu   /(   u   exu   ±(   u   exu   .(   u   exu   Ë(   u   exu   ,(   u   rmu   ^(   u   exu   b(   u   exu   c(   u   exu   d(   u   rmu   ~(   u   exu   e(   u   exu   f(   u   exu   g(   u   calu   h(   u   exu   D(   u   calu   i(   u   exu   E(   u
   \leftparenu   ((   u   \rightparentu   )(   u
   \leftbraceu   {(   u   \rightbraceu   }(   u   \leftbracketu   [(   u   \rightbracketu   ](   u   \{u   {(   u   \}u   }(   u   \[u   [(   u   \]u   ](   RP   RQ   RR   R   R>   R   t   splitR   R   R   R   t   aliast   targetR   (    (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR     sx   

						
	
		
	
t   UnicodeFontsc           B` sM   e  Z d  Z e Z d   Z e d j    Z d   Z	 e d  Z
 d   Z RS(   ua  
    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.
    c         O` s   t  d r t | |   |  _ n	 d  |  _ t j |  | |  i  |  _ x; d j   D]- } t  d | } t |  } | |  j | <qQ Wt	 d  } t |  } | |  j d <d  S(   Nu   mathtext.fallback_to_cmu   cal rm tt it bf sfu	   mathtext.u   cmex10u   ex(
   R   R   t   cm_fallbackRT   R   R>   R   R   R%   R&   (   R=   R   R   t   texfontt   propRa   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR>     s    
		u
   \int \ointc         C` s
   | | f S(   N(    (   R=   R   R   t   uniindex(    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyt   _map_virtual_font  s    c         C` s  t  } |  j r< t j |  } | d  k	 r< d } t } q< n  | s y t | |  } t } Wq t k
 r t d  } t	 d | j
 d d  t  q Xn  |  j | | |  \ } } | } | r| d k r'| d k  r't |  }	 t j |	  d d	 k st j |	  j d
  r$d } q$q'n  | d k p?| |  j k }
 t  } |  j |  } | d  k	 r| j |  } | d k rt } qqn  | s|  j rt |  j t  rt	 d t  n  | d k rt |  j t  r|  j j d | | |  S|  j j | | | |  Sq| d k rBt |  t  rB|  j d | | |  St	 d | | j
 d d  j d  | f t  t	 d t  d } | } |  j |  } d } | j |  } t  }
 n  | j |  } | | | | |
 f S(   Nu   exu   ?u"   No TeX to unicode mapping for '%s'u   asciiu   backslashreplaceu   iti   i    u   Lu   GREEK CAPITALu   rmu0   Substituting with a symbol from Computer Modern.u   regularu/   Font '%s' does not have a glyph for '%s' [U+%x]u!   Substituting with a dummy symbol.i   (   u   itu   regular(   u   itu   regular(   t   Falset   use_cmexR+   R   RT   R   R6   R2   R-   R   t   encodet   MathTextWarningR   R   t   unicodedatat   categoryt   namet
   startswithR   R   R   R   t
   isinstanceR   R   R   t   decodeR   (   R=   R   R   R   R{   R4   t   found_symbolR   t   new_fontnamet	   unistringR   Ra   t
   glyphindexR|   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR     sv    	
	
			c         C` s)   |  j  r |  j  j | |  S| | f g S(   N(   R   R   (   R=   R   R   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR   ]  s    		
(   RP   RQ   RR   R   R   R>   R   R   R   R   R   R   (    (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR     s   
		It   DejaVuFontsc           B` s#   e  Z e Z d    Z e d  Z RS(   c         O` s   t  |  t  r$ t | |   |  _ n t | |   |  _ t | |   |  _ t j |  | |  i  |  _	 |  j
 j i d d 6d d 6d d 6d d 6d	 d
 6 xF t j |  j
  D]2 \ } } t |  } | |  j	 | <| |  j	 | <q Wd  S(   Nu   STIXSizeOneSymi   u   STIXSizeTwoSymi   u   STIXSizeThreeSymi   u   STIXSizeFourSymi   u   STIXSizeFiveSymi   (   R   t   DejaVuSerifFontsR   R   t   StixSansFontsR   t   bakomaR   R>   R   R   t   updateRt   R   R%   (   R=   R   R   R   R   R   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR>   g  s     	c   	      C` s   | d k r( |  j  j | | | | |  St |  } |  j d  } | d k	 r | j |  } | d k r t t |   j d | | | |  Sn  t t |   j | | | | |  Sd S(   u%    Override prime symbol to use Bakoma u   \primeu   exi    N(   R   R   R6   R   RT   R   t   superR   (	   R=   R   R   R   R{   R4   R   Ra   R   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR   |  s    (   RP   RQ   R   R   R>   R   R   (    (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR   d  s   	R   c           B` sE   e  Z d  Z i d d 6d d 6d d 6d d 6d	 d
 6d d 6d d 6Z RS(   uv   
    A font handling class for the DejaVu Serif fonts

    If a glyph is not found it will fallback to Stix Serif
    u   DejaVu Serifu   rmu   DejaVu Serif:italicu   itu   DejaVu Serif:weight=boldu   bfu   DejaVu Sansu   sfu   DejaVu Sans Monou   ttu   DejaVu Serif Displayu   exi    (   RP   RQ   RR   R   (    (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR     s   
t   DejaVuSansFontsc           B` sE   e  Z d  Z i d d 6d d 6d d 6d d 6d d	 6d
 d 6d d 6Z RS(   ut   
    A font handling class for the DejaVu Sans fonts

    If a glyph is not found it will fallback to Stix Sans
    u   DejaVu Sansu   rmu   DejaVu Sans:italicu   itu   DejaVu Sans:weight=boldu   bfu   sfu   DejaVu Sans Monou   ttu   DejaVu Sans Displayu   exi    (   RP   RQ   RR   R   (    (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR     s   
R   c           B` s   e  Z d  Z i d d 6d d 6d d 6d d 6d	 d
 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6Z e Z e Z e Z d   Z d   Z	 i  Z
 d   Z RS(   ua  
    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.
    u   STIXGeneralu   rmu   STIXGeneral:italicu   itu   STIXGeneral:weight=boldu   bfu   STIXNonUnicodeu   nonunirmu   STIXNonUnicode:italicu   nonuniitu   STIXNonUnicode:weight=boldu   nonunibfi    u   STIXSizeOneSymi   u   STIXSizeTwoSymi   u   STIXSizeThreeSymi   u   STIXSizeFourSymi   u   STIXSizeFiveSymi   c         O` si   t  j |  | |  i  |  _ xF t j |  j  D]2 \ } } t |  } | |  j | <| |  j | <q/ Wd  S(   N(   R   R>   R   Rt   R   R   R%   (   R=   R   R   R   R   R   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR>     s    	c   
      C` s  t  j |  } |  j rC | d  k rC | d k rC t  d } t } n t } | d  k	 rft | t  r y | | } Wq t k
 r | d } q Xn  d } t	 |  } x_ | | k  r| | d } | | }	 | |	 d k  r | } q | |	 d k r Pq | d } q W| |	 d k rJ| |	 d k rJ| |	 d |	 d } |	 d } qf| sfd } t
 d	 } qfn  | d k r| d k r| d k rd | } n  | | f S(   Nu   regularu   defaultu   sfu   rmi    i   i   i   u   mathtext.defaultu   itu   bfi   i  u   nonuni(   u   regularu   default(   u   itu   rmu   bf(   R,   R   t   _sansRT   R   R   R   t   dictR0   R   R   (
   R=   R   R   R   t   mappingt   doing_sans_conversiont   lot   hit   midt   range(    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR     s@    
	
	 c   
      C` s=  i d d 6d d 6d d 6d d 6} | j  | |  } |  j j  |  } | rP | Sg  } y t |  } Wn t k
 r | | f g SXi d	 t d
  6d t d  6} | j  | |  } xZ t d  D]L } |  j |  } | j |  }	 |	 d k r | j | t	 |  f  q q W| d k r,| d  } n  | |  j | <| S(   Nu   {u   \{u   }u   \}u   [u   \[u   ]u   \]i'  u   <i'  u   >i   i    u	   \__sqrt__i(
   R   R   R6   R2   R-   R   R   R   R   R8   (
   R=   R   R   t   fixest   alternativesR   t   fix_upst   iRa   R   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR     s.    " (   RP   RQ   RR   R   R   R   R   R   R>   R   R   R   (    (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR     s(   

		.R   c           B` s   e  Z d  Z e Z RS(   ud   
    A font handling class for the STIX fonts (that uses sans-serif
    characters by default).
    (   RP   RQ   RR   R   R   (    (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR   $  s   t   StandardPsFontsc           B` s   e  Z d  Z e j j e   d d  Z i d d 6d d 6d d 6d	 d
 6d d 6d d 6d d 6Z	 d   Z
 d   Z e d  Z d   Z d   Z d   Z RS(   u   
    Use the standard postscript fonts for rendering to backend_ps

    Unlike the other font classes, BakomaFont and UnicodeFont, this
    one requires the Ps backend.
    u   fontsu   afmu   pzcmi8au   calu   pncr8au   rmu   pcrr8au   ttu   pncri8au   itu   phvr8au   sfu   pncb8au   bfu   psyrc         C` s   t  j |  | t    i  |  _ i  |  _ t | d d d |  j } | d  k rm t d d d d |  j } n  t | d   } t	 |  } Wd  QX| | _
 | |  j d <| |  j d <t j j   |  _ d  S(   Nt   fontextu   afmt	   directoryu	   Helveticau   rbu   defaultu   regular(   R   R>   Rs   R   t   fontsR%   t   basepathRT   t   openR   R   Rt   Ru   Rv   Rw   (   R=   R   R   t   fdR   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR>   =  s    			c         C` s   | |  j  k r |  j  | } n | } |  j j |  } | d  k r t j j |  j | d  } t | d   } t	 |  } Wd  QX| | _
 | |  j | <| |  j | j   <n  | S(   Nu   .afmu   rb(   R   R  R   RT   R   R   t   joinR  R  R   R   t   get_fontname(   R=   Ra   R   R   R   R  (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR   O  s    	c         C` s  | | | | f } |  j  j |  } | d k	 r4 | S| d k r} t |  d k st t j t j |   j d  r} d } n  t	 }	 | t
 k r t
 | \ } }
 t |
  } t }	 nC t |  d k r | } t |  }
 t }	 n t d j |  t  | d k } |  j |  } |	 rgy | j |  } Wqgt k
 rct d j | j   |  t  t	 }	 qgXn  |	 sd } } t |  }
 | j |  } n  d } d	 | } g  | j |  D] } | | ^ q\ } } } } t d
 | j |  | d | j |  | d | j |  | d | d | d | | d | | d | | d |  	} t d | d | d | j   d | d | d |
 d | d |  |  j  | <|  j  | S(   u/   load the cmfont, metrics and glyph with cachingu   iti   u   Lu   rmu.   No TeX to built-in Postscript mapping for {!r}u2   No glyph in standard Postscript font {!r} for {!r}u   ?i    gMbP?R   R:   R;   R]   R_   R`   R^   Rc   R   Ra   R{   Rz   R\   R|   R   Rd   Ry   N(   R   R   RT   R   R   R   Rt   t	   text_typeR   R   R)   t   chrR   R-   R   t   formatR   R   t   get_name_charR0   R
  t   get_bbox_charR   t   get_width_chart   get_height_char(   R=   R   R   R   R{   R   R4   R   t   tupR   R   Rd   R   Ra   R|   Ry   t   scaleR   R]   R`   R_   R^   R\   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR   _  sp    "				

/


	c
         C` s   | | k ru | | k ru |  j  | | | | |	  }
 |  j  | | | | |	  } |
 j } | j |
 j | j  d | St j |  | | | | | | | | |	 
 S(   NgMbP?(   R   Ra   t   get_kern_distRd   R   R   (   R=   R   R   R   R   R   R   R   R   R   R   R   Ra   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR     s    	c         C` s!   |  j  |  } | j   d | S(   NgMbP?(   R   R   (   R=   Ra   R{   R   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR     s    c         C` s!   |  j  |  } | j   d | S(   NgMbP?(   R   R   (   R=   Ra   R{   R   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR     s    N(   RP   RQ   RR   R   R   R	  R   R  RT   R   R>   R   R   R   R   R   R   (    (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR  +  s   

		M		gffffff?g      ?i   t   FontConstantsBasec           B` s>   e  Z d  Z d Z d Z d Z d Z d Z d Z d Z	 d Z
 RS(	   u   
    A set of constants that controls how certain things, such as sub-
    and superscripts are laid out.  These are all metrics that can't
    be reliably retrieved from the font metrics in the font itself.
    g?g?gffffff?g333333?g      ?g?g?g?(   RP   RQ   RR   t   script_spacet   subdropt   sup1t   sub1t   sub2t   deltat   delta_slantedt   delta_integral(    (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR    s   t   ComputerModernFontConstantsc           B` s8   e  Z d  Z d Z d Z d Z d Z d  Z d Z d Z	 RS(   g333333?g?g?g333333?(
   RP   RQ   R  R  R  R  R  R  R  R  (    (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR    s   t   STIXFontConstantsc           B` s,   e  Z d  Z d Z d Z d Z d Z d Z RS(   g?g?g333333?g?g333333?(   RP   RQ   R  R  R  R  R  R  (    (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR    s   t   STIXSansFontConstantsc           B` s    e  Z d  Z d Z d Z d Z RS(   g?g?g333333?g333333?(   RP   RQ   R  R  R  R  (    (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR     s   t   DejaVuSerifFontConstantsc           B` s   e  Z RS(    (   RP   RQ   (    (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR!     s   t   DejaVuSansFontConstantsc           B` s   e  Z RS(    (   RP   RQ   (    (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR"  $  s   u   DejaVu Sansu   DejaVu Sans Monou   DejaVu Serifu   cmb10u   cmex10u   cmmi10u   cmr10u   cmss10u   cmsy10u   cmtt10u   STIXGeneralu   STIXNonUnicodeu   STIXSizeFiveSymu   STIXSizeFourSymu   STIXSizeThreeSymu   STIXSizeTwoSymu   STIXSizeOneSymu   Bitstream Vera Sansu   Bitstream Verac         C` sJ   t  j |  j j |  j  j t  } | t k rF t |  j t	  rF t
 S| S(   N(   t   _font_constant_mappingR   t   font_outputR   Ra   t   family_nameR  R  R   R   R   (   t   statet	   constants(    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyt   _get_font_constant_setA  s    	R   c           B` s   e  Z RS(    (   RP   RQ   (    (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR   M  s   t   Nodec           B` sM   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 RS(   u%   
    A node in the TeX box model
    c         C` s   d |  _  d  S(   Ni    (   t   size(   R=   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR>   T  s    c         C` s
   |  j    S(   N(   t   __internal_repr__(   R=   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyt   __repr__W  s    c         C` s
   |  j  j S(   N(   t	   __class__RP   (   R=   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR+  Z  s    c         C` s   d S(   Ng        (    (   R=   t   next(    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR   ]  s    c         C` s   |  j  d 7_  d S(   u   
        Shrinks one level smaller.  There are only three levels of
        sizes, after which things will no longer get smaller.
        i   N(   R*  (   R=   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyt   shrink`  s    c         C` s   |  j  d 8_  d S(   ub   
        Grows one level larger.  There is no limit to how big
        something can get.
        i   N(   R*  (   R=   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyt   growg  s    c         C` s   d  S(   N(    (   R=   t   xRh   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyt   rendern  s    (
   RP   RQ   RR   R>   R,  R+  R   R/  R0  R2  (    (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR)  P  s   						t   Boxc           B` s2   e  Z d  Z d   Z d   Z d   Z d   Z RS(   u7   
    Represents any node with a physical location.
    c         C` s,   t  j |   | |  _ | |  _ | |  _ d  S(   N(   R)  R>   R:   R;   R<   (   R=   R:   R;   R<   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR>   u  s    		c         C` sP   t  j |   |  j t k  rL |  j t 9_ |  j t 9_ |  j t 9_ n  d  S(   N(   R)  R/  R*  t   NUM_SIZE_LEVELSR:   t   SHRINK_FACTORR;   R<   (   R=   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR/  {  s
    c         C` s>   t  j |   |  j t 9_ |  j t 9_ |  j t 9_ d  S(   N(   R)  R0  R:   t   GROW_FACTORR;   R<   (   R=   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR0    s    c         C` s   d  S(   N(    (   R=   RH   RI   RJ   RK   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR2    s    (   RP   RQ   RR   R>   R/  R0  R2  (    (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR3  q  s
   			t   Vboxc           B` s   e  Z d  Z d   Z RS(   u.   
    A box with only height (zero width).
    c         C` s   t  j |  d | |  d  S(   Ng        (   R3  R>   (   R=   R;   R<   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR>     s    (   RP   RQ   RR   R>   (    (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR7    s   t   Hboxc           B` s   e  Z d  Z d   Z RS(   u8   
    A box with only width (zero height and depth).
    c         C` s   t  j |  | d d  d  S(   Ng        (   R3  R>   (   R=   R:   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR>     s    (   RP   RQ   RR   R>   (    (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR8    s   t   Charc           B` sY   e  Z d  Z e d  Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d   Z RS(	   u#  
    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`.
    c         C` si   t  j |   | |  _ | j |  _ | j |  _ | j |  _ | j |  _ | j |  _ | |  _ |  j	   d  S(   N(
   R)  R>   t   cR$  Ra   R   R{   R   R4   t   _update_metrics(   R=   R:  R&  R4   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR>     s    		c         C` s   d |  j  S(   Nu   `%s`(   R:  (   R=   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR+    s    c         C` s   |  j  j |  j |  j |  j |  j |  j |  j  } |  _ |  j d k rX | j	 |  _
 n | j
 |  _
 | j |  _ | j | j |  _ d  S(   Nu    (   R$  R   Ra   R   R:  R{   R   R4   t   _metricsR   R:   Rc   R;   R<   (   R=   R\   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR;    s    	1c         C` s
   |  j  j S(   N(   R<  R   (   R=   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyt
   is_slanted  s    c      
   C` sx   |  j  j |  j } d } t | t  rp |  j j |  j |  j |  j	 |  j
 | j | j | j	 | j
 |  j 	 } n  | | S(   u   
        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        (   R<  R   R:   R   R9  R$  R   Ra   R   R:  R{   R   (   R=   R.  R   t   kern(    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR     s    	c         C` s5   |  j  j | | |  j |  j |  j |  j |  j  d S(   u4   
        Render the character to the canvas
        N(   R$  RG   Ra   R   R:  R{   R   (   R=   R1  Rh   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR2    s    	c         C` s_   t  j |   |  j t k  r[ |  j t 9_ |  j t 9_ |  j t 9_ |  j t 9_ n  d  S(   N(	   R)  R/  R*  R4  R{   R5  R:   R;   R<   (   R=   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR/    s    c         C` sM   t  j |   |  j t 9_ |  j t 9_ |  j t 9_ |  j t 9_ d  S(   N(   R)  R0  R{   R6  R:   R;   R<   (   R=   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR0    s
    (   RP   RQ   RR   R   R>   R+  R;  R=  R   R2  R/  R0  (    (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR9    s   
		
				t   Accentc           B` s2   e  Z d  Z d   Z d   Z d   Z d   Z RS(   u   
    The font metrics need to be dealt with differently for accents,
    since they are already offset correctly from the baseline in
    TrueType fonts.
    c         C` sg   |  j  j |  j |  j |  j |  j |  j  } |  _ | j | j	 |  _
 | j | j |  _ d |  _ d  S(   Ni    (   R$  R   Ra   R   R:  R{   R   R<  R_   R]   R:   R^   R`   R;   R<   (   R=   R\   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR;    s
    	+c         C` s   t  j |   |  j   d  S(   N(   R9  R/  R;  (   R=   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR/    s    c         C` s   t  j |   |  j   d  S(   N(   R9  R0  R;  (   R=   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR0    s    c         C` sI   |  j  j | |  j j | |  j j |  j |  j |  j |  j |  j	  d S(   u5   
        Render the character to the canvas.
        N(
   R$  RG   R<  R]   R`   Ra   R   R:  R{   R   (   R=   R1  Rh   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR2    s    	(   RP   RQ   RR   R;  R/  R0  R2  (    (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR?    s
   			t   Listc           B` sD   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   u:   
    A list of nodes (either horizontal or vertical).
    c         C` sG   t  j |  d d d  d |  _ | |  _ d |  _ d |  _ d |  _ d  S(   Ng        i    (   R3  R>   t   shift_amountt   childrent   glue_sett	   glue_signt
   glue_order(   R=   t   elements(    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR>     s    				c         C` sQ   d |  j    |  j |  j |  j |  j d j g  |  j D] } t |  ^ q4  f S(   Nu!   [%s <%.02f %.02f %.02f %.02f> %s]u    (   R+  R:   R;   R<   RA  R	  RB  t   repr(   R=   R1  (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR,    s
    	c         C` sK   d } x> t  t |  d d d  D]  } | | d k r# | } Pq# q# W| S(   u   
        A helper function to determine the highest order of glue
        used by the members of this list.  Used by vpack and hpack.
        i    i   ig        (   R   R   (   R=   t   totalst   oR  (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyt   _determine_order  s    #c         C` s   |  j  |  } | |  _ | |  _ | | d k rE | | | |  _ n d |  _ d |  _ | d k r t |  j  r t d | |  j j	 |  f t
  q n  d  S(   Ng        i    u	   %s %s: %r(   RJ  RE  RD  RC  t
   glue_ratioR   RB  R   R-  RP   R   (   R=   R1  t   signRH  t
   error_typeRI  (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyt	   _set_glue$  s    				c         C` s_   x |  j  D] } | j   q
 Wt j |   |  j t k  r[ |  j t 9_ |  j t 9_ n  d  S(   N(   RB  R/  R3  R*  R4  RA  R5  RC  (   R=   t   child(    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR/  2  s    c         C` sM   x |  j  D] } | j   q
 Wt j |   |  j t 9_ |  j t 9_ d  S(   N(   RB  R0  R3  RA  R6  RC  (   R=   RO  (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR0  :  s
    (	   RP   RQ   RR   R>   R,  RJ  RN  R/  R0  (    (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR@    s   						t   Hlistc           B` s8   e  Z d  Z d d e d  Z d   Z d d d  Z RS(   u%   
    A horizontal list of boxes.
    g        u
   additionalc         C` s1   t  j |  |  | r# |  j   n  |  j   d  S(   N(   R@  R>   R>  t   hpack(   R=   RF  R?   t   mt   do_kern(    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR>   E  s    c         C` s   g  } t  |  j  } | r x t |  D] } |  j | } | | d k  r_ |  j | d } n d } | j |  | j |  } | d k r( t |  } | j |  q( q( W| |  _ n  d S(   u)  
        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.
        i   g        N(   R   RB  R   RT   R   R   t   Kern(   R=   t   new_childrent   num_childrenR  t   elemR.  t   kerning_distanceR>  (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR>  K  s    c         C` s$  d } d } d } d g d } d g d } xM|  j  D]B} t | t  r | | j 7} t | | j  } t | | j  } q6 t | t  r| | j 7} t j	 | j  rxt j	 | j  rxt
 | d d  }	 t | | j |	  } t | | j |	  } qxq6 t | t  rY| j }
 | |
 j 7} | |
 j c |
 j 7<| |
 j c |
 j 7<q6 t | t  r6 | | j 7} q6 q6 W| |  _ | |  _ | d k r| | 7} n  | |  _ | | } | d k rd |  _ d |  _ d |  _ d S| d k r
|  j | d | d  n |  j | d	 | d
  d S(   u  
        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.
        g        i   u   shift_amountu
   additionali    Ni   u   Overfulliu	   Underfull(   RB  R   R9  R:   RY   R;   R<   R3  t   npR   t   getattrt   Gluet	   glue_spect   stretch_ordert   stretcht   shrink_orderR/  RT  RD  RE  RK  RN  (   R=   R?   RR  R@   RA   R1  t   total_stretcht   total_shrinkt   pt   sR\  (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyRQ  q  sJ    &				
			(   RP   RQ   RR   R   R>   R>  RQ  (    (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyRP  A  s   	&t   Vlistc           B` s2   e  Z d  Z d d d  Z d d e j d  Z RS(   u#   
    A vertical list of boxes.
    g        u
   additionalc         C` s   t  j |  |  |  j   d  S(   N(   R@  R>   t   vpack(   R=   RF  R@   RR  (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR>     s    c         C` s"  d } d } d } d g d } d g d } x%|  j  D]}	 t |	 t  r | | |	 j 7} |	 j } t j |	 j  sPt |	 d d  }
 t	 | |	 j |
  } qPq6 t |	 t
  r	| | 7} d } |	 j } | | j 7} | | j c | j 7<| | j c | j 7<q6 t |	 t  r2| | |	 j 7} d } q6 t |	 t  r6 t d   q6 q6 W| |  _ | | k r| | | 7} | |  _ n	 | |  _ | d k r| | 7} n  | |  _ | | } | d k rd |  _ d |  _ d |  _ d S| d k r|  j | d | d	  n |  j | d
 | d  d S(   u6  
        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.
        g        i   u   shift_amountu2   Internal mathtext error: Char node found in Vlist.u
   additionali    Ni   u   Overfulliu	   Underfull(   RB  R   R3  R;   R<   RY  R   R:   RZ  RY   R[  R\  R]  R^  R_  R/  RT  R9  t   RuntimeErrorRD  RE  RK  RN  (   R=   R@   RR  t   lR?   RA   R1  R`  Ra  Rb  Rc  R\  (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyRe    sR    	
					
			(   RP   RQ   RR   R>   RY  R   Re  (    (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyRd    s   t   Rulec           B` s    e  Z d  Z d   Z d   Z RS(   u  
    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`.
    c         C` s&   t  j |  | | |  | j |  _ d  S(   N(   R3  R>   R$  (   R=   R:   R;   R<   R&  (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR>     s    c         C` s%   |  j  j | | | | | |  d  S(   N(   R$  RL   (   R=   R1  Rh   R?   R@   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR2    s    (   RP   RQ   RR   R>   R2  (    (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyRh    s   		t   Hrulec           B` s   e  Z d  Z d d  Z RS(   u8   
    Convenience class to create a horizontal rule.
    c         C` s^   | d  k r0 | j j | j | j | j  } n  | d } } t j |  t j	 | | |  d  S(   Ng      ?(
   RT   R$  R   Ra   R{   R   Rh  R>   RY  R   (   R=   R&  t	   thicknessR;   R<   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR>     s
    	N(   RP   RQ   RR   RT   R>   (    (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyRi    s   t   Vrulec           B` s   e  Z d  Z d   Z RS(   u6   
    Convenience class to create a vertical rule.
    c         C` sD   | j  j | j | j | j  } t j |  | t j t j |  d  S(   N(	   R$  R   Ra   R{   R   Rh  R>   RY  R   (   R=   R&  Rj  (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR>     s    	(   RP   RQ   RR   R>   (    (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyRk    s   R[  c           B` s,   e  Z d  Z e d  Z d   Z d   Z RS(   u  
    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.)
    c         C` s   t  j |   d |  _ t | t j  r: t j |  } n$ t | t  rR | } n t d   | rs | j	   } n  | |  _
 d  S(   Nu   normalu/   glue_type must be a glue spec name or instance.(   R)  R>   t   glue_subtypeR   Rt   t   string_typest   GlueSpect   factoryR2   t   copyR\  (   R=   t	   glue_typeRp  R\  (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR>   &  s    		c         C` s\   t  j |   |  j t k  rX |  j j d k rX |  j j   |  _ |  j j t 9_ qX n  d  S(   Ng        (   R)  R/  R*  R4  R\  R:   Rp  R5  (   R=   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR/  3  s
    c         C` sJ   t  j |   |  j j d k rF |  j j   |  _ |  j j t 9_ n  d  S(   Ng        (   R)  R0  R\  R:   Rp  R6  (   R=   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR0  :  s    (   RP   RQ   RR   R   R>   R/  R0  (    (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR[    s   	Rn  c           B` sD   e  Z d  Z d d d d d d  Z d   Z d   Z e e  Z RS(   u   
    See :class:`Glue`.
    g        i    c         C` s1   | |  _  | |  _ | |  _ | |  _ | |  _ d  S(   N(   R:   R^  R]  R/  R_  (   R=   R:   R^  R]  R/  R_  (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR>   D  s
    				c         C` s%   t  |  j |  j |  j |  j |  j  S(   N(   Rn  R:   R^  R]  R/  R_  (   R=   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyRp  K  s    c         C` s   |  j  | S(   N(   t   _types(   t   clsRq  (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyRo  S  s    (   RP   RQ   RR   R>   Rp  Ro  t   classmethod(    (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyRn  @  s
   		g        i   u   fili   u   filli   u   filllu   neg_filu   neg_fillu	   neg_filllu   emptyg      u   sst   Filc           B` s   e  Z d    Z RS(   c         C` s   t  j |  d  d  S(   Nu   fil(   R[  R>   (   R=   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR>   e  s    (   RP   RQ   R>   (    (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyRu  d  s   t   Fillc           B` s   e  Z d    Z RS(   c         C` s   t  j |  d  d  S(   Nu   fill(   R[  R>   (   R=   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR>   i  s    (   RP   RQ   R>   (    (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyRv  h  s   t   Filllc           B` s   e  Z d    Z RS(   c         C` s   t  j |  d  d  S(   Nu   filll(   R[  R>   (   R=   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR>   m  s    (   RP   RQ   R>   (    (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyRw  l  s   t   NegFilc           B` s   e  Z d    Z RS(   c         C` s   t  j |  d  d  S(   Nu   neg_fil(   R[  R>   (   R=   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR>   q  s    (   RP   RQ   R>   (    (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyRx  p  s   t   NegFillc           B` s   e  Z d    Z RS(   c         C` s   t  j |  d  d  S(   Nu   neg_fill(   R[  R>   (   R=   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR>   u  s    (   RP   RQ   R>   (    (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyRy  t  s   t   NegFilllc           B` s   e  Z d    Z RS(   c         C` s   t  j |  d  d  S(   Nu	   neg_filll(   R[  R>   (   R=   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR>   y  s    (   RP   RQ   R>   (    (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyRz  x  s   t   SsGluec           B` s   e  Z d    Z RS(   c         C` s   t  j |  d  d  S(   Nu   ss(   R[  R>   (   R=   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR>   }  s    (   RP   RQ   R>   (    (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR{  |  s   t	   HCenteredc           B` s   e  Z d  Z d   Z RS(   us   
    A convenience class to create an :class:`Hlist` whose contents are
    centered within its enclosing box.
    c         C` s.   t  j |  t   g | t   g d t d  S(   NRS  (   RP  R>   R{  R   (   R=   RF  (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR>     s    #(   RP   RQ   RR   R>   (    (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR|    s   t	   VCenteredc           B` s   e  Z d  Z d   Z RS(   ur   
    A convenience class to create a :class:`Vlist` whose contents are
    centered within its enclosing box.
    c         C` s(   t  j |  t   g | t   g  d  S(   N(   Rd  R>   R{  (   R=   RF  (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR>     s    (   RP   RQ   RR   R>   (    (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR}    s   RT  c           B` s>   e  Z d  Z d Z d Z d   Z d   Z d   Z d   Z RS(   u  
    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.
    i    c         C` s   t  j |   | |  _ d  S(   N(   R)  R>   R:   (   R=   R:   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR>     s    c         C` s   d |  j  S(   Nu   k%.02f(   R:   (   R=   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR,    s    c         C` s2   t  j |   |  j t k  r. |  j t 9_ n  d  S(   N(   R)  R/  R*  R4  R:   R5  (   R=   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR/    s    c         C` s    t  j |   |  j t 9_ d  S(   N(   R)  R0  R:   R6  (   R=   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR0    s    (	   RP   RQ   RR   R;   R<   R>   R,  R/  R0  (    (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyRT    s   				t   SubSuperClusterc           B` s   e  Z d  Z d   Z RS(   uR  
    :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.
    c         C` s/   d  |  _ d  |  _ d  |  _ t j |  g   d  S(   N(   RT   t   nucleust   subR   RP  R>   (   R=   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR>     s    			(   RP   RQ   RR   R>   (    (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR~    s   t   AutoHeightCharc           B` s   e  Z d  Z e d d  Z RS(   uG  
    :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&  | j  j | j |  } | j  j | j | j | j  } | j   } | | }	 xN | D]F \ }
 } |
 | _ t | |  } | j | j	 |	 d | k rV PqV qV Wd } | j d k r| d  k r |	 | j | j	 } n  | j | 9_ t | |  } | | j	 } n  t j |  | g  | |  _ d  S(   Ng?i    (   R$  R   Ra   R   R{   R   Rp  R9  R;   R<   RT   RP  R>   RA  (   R=   R:  R;   R<   R&  t   alwayst   factorR   R   t   target_totalR   R   t   chart   shift(    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR>     s(    		
	N(   RP   RQ   RR   R   RT   R>   (    (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR    s   t   AutoWidthCharc           B` s   e  Z d  Z e e d  Z RS(   u:  
    :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   | j  j | j |  } | j   } x? | D]7 \ } } | | _ | | |  }	 |	 j | k r+ Pq+ q+ W| |	 j }
 | j |
 9_ | | |  }	 t j |  |	 g  |	 j |  _ d  S(   N(   R$  R   Ra   Rp  R:   R{   RP  R>   (   R=   R:  R:   R&  R  t
   char_classR   R   R   R  R  (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR>     s    		(   RP   RQ   RR   R   R9  R>   (    (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR    s   t   Shipc           B` s>   e  Z d  Z d   Z d   Z e e  Z d   Z d   Z RS(   u  
    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.
    c         C` sN   d |  _  d |  _ d |  _ d |  _ | |  _ | | j |  _ |  j |  d  S(   Ni    g        (   t   max_pusht   cur_st   cur_vt   cur_ht   off_hR;   t   off_vt	   hlist_out(   R=   RD   RE   RM   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyt   __call__  s    					c         C` s$   |  d k  r d S|  d k r  d S|  S(   Ng    eg    eA(    (   t   value(    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyt   clamp  s
    c         C` s;  d } d } | j  } | j } |  j } |  j } |  j d 7_ t |  j |  j  |  _ |  j } x| j D]}	 t	 |	 t
  r |	 j |  j |  j |  j |  j  |  j |	 j 7_ qj t	 |	 t  r |  j |	 j 7_ qj t	 |	 t  rvt |	 j  d k r|  j |	 j 7_ q$|  j }
 | |	 j |  _ t	 |	 t  rM|  j |	  n |  j |	  |
 |	 j |  _ | |  _ qj t	 |	 t  rC|	 j } |	 j } |	 j } t j |  r| j } n  t j |  r| j } n  | d k r1| d k r1| | |  _ |	 j |  j |  j |  j |  j | |  | |  _ n  |  j | 7_ qj t	 |	 t  rj |	 j } | j | } | d k r| d k r| j | k r| | j 7} t j | t  | j!  |   } qq| j" | k r| | j# 7} t j | t  | j!  |   } qn  | | 7} |  j | 7_ qj qj W|  j d 8_ d  S(   Ni    g        i   ($   RE  RD  R  R  R  RY   R  R  RB  R   R9  R2  R  R  R:   RT  R@  R   RA  RP  R  t	   vlist_outR3  R;   R<   RY  R   R[  R\  R]  R^  t   roundt   floatRC  R_  R/  (   R=   RM   t   cur_gt   cur_glueRE  RD  t	   base_linet	   left_edgeR  Rb  t   edget   rule_heightt
   rule_deptht
   rule_widthR\  (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR    sl    					$				
	((
c         C` s!  d } d } | j  } | j } |  j d 7_ t |  j |  j  |  _ |  j } |  j | j 8_ |  j } |  j } x| j	 D]}	 t
 |	 t  r |  j |	 j 7_ q| t
 |	 t  ret |	 j	  d k r |  j |	 j |	 j 7_ q
|  j |	 j 7_ | |	 j |  _ |  j }
 | j |	 _ t
 |	 t  r<|  j |	  n |  j |	  |
 |	 j |  _ | |  _ q| t
 |	 t  r|	 j } |	 j } |	 j } t j |  r| j } n  | | 7} | d k r
| d k r
|  j | 7_ |	 j |  j |  j |  j |  j | |  q
q| t
 |	 t  r|	 j } | j | } | d k r| d k r| j | k r| | j 7} t j | t | j   |   } qq| j! | k r| | j" 7} t j | t | j   |   } qn  | | 7} |  j | 7_ q| t
 |	 t#  r| t$ d   q| q| W|  j d 8_ d  S(   Ni    g        i   u1   Internal mathtext error: Char node found in vlist(%   RE  RD  R  RY   R  R  R  R;   R  RB  R   RT  R:   R@  R   R<   RA  RP  R  R  R3  RY  R   R2  R  R  R[  R\  R]  R^  R  R  RC  R_  R/  R9  Rf  (   R=   RM   R  R  RE  RD  R  t   top_edgeR  Rb  t   save_vR  R  R  R\  (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR  V  sj    									
	((
(   RP   RQ   RR   R  R  t   staticmethodR  R  (    (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR    s   					?c         ` s)     f d   } t    } | j |  | S(   u.   
    Helper class to raise parser errors.
    c         ` s   t  |  |     d  S(   N(   R   (   Rc  t   loct   toks(   t   msg(    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyt   raise_error  s    (   R
   t   setParseAction(   R  R  t   empty(    (   R  s2   lib/python2.7/site-packages/matplotlib/mathtext.pyt   Error  s    	t   Parserc        	   B` s  e  Z d  Z e d d d d d d d d  Z e d	 j    Z e d
 j    Z e d j    Z	 e e Be	 BZ
 e d j    Z e d j    Z e d j    Z e d j    Z e d j    Z e d j    Z e d j    Z e d j    Z e d j    Z d   Z d   Z d e f d     YZ d   Z d   Z d   Z d   Z d   Z d   Z d   Z d    Z i d! d" 6d! d# 6d! d$ 6d% d& 6d% d' 6d( d) 6d* d+ 6d, d- 6d d. 6d d/ 6d0 d1 6Z  d2   Z! d3   Z" d4   Z# e# Z$ d5   Z% i dr dt d: f d; 6Z' d<   Z( i d= d> 6d? d@ 6dA dB 6dC dD 6dE dF 6dG dH 6dI dJ 6dK dL 6dM dN 6dK dO 6dC dP 6dE dQ 6dG dR 6dI dS 6d= dT 6dU dV 6dW dX 6d9 dY 6Z) e dZ j    Z* d[   e e)   Z+ d\   Z, d]   Z- d^   Z. d_   Z/ d`   Z0 e0 Z1 Z2 da   Z3 db   Z4 dc   Z5 dd   Z6 de   Z7 df   Z8 dg   Z9 dh   Z: di   Z; dj   Z< dk   Z= dl   Z> dm   Z? dn   Z@ do   ZA dp   ZB dq   ZC RS(u   u  
    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.
    t   displaystylei    t	   textstylei   t   scriptstylei   t   scriptscriptstylei   u  
      + * -
      \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                     \amalgu  
      = < > :
      \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          \dots            \dotplus         \doteqdotu  
      \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      \leadstou   , ; . ! \ldotp \cdotpu}   
       \sum \prod \coprod \bigcap \bigcup \bigsqcup \bigvee
       \bigwedge \bigodot \bigotimes \bigoplus \biguplus
       u   lim liminf limsup sup max minu
   \int \ointu6   rm cal it tt sf bf default bb frak circled scr regularu   
      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 tanhur   
      | \| / \backslash \uparrow \downarrow \updownarrow \Uparrow
      \Downarrow \Updownarrow . \vert \Vert \\|u   ( [ \{ < \lfloor \langle \lceilu   ) ] \} > \rfloor \rangle \rceilc      
   C` s  t    } t   | _ t   | _ t   | _ t   | _ t   | _ t   | _ t   | _ t   | _	 t   | _
 t   | _ t   | _ t   | _ t   | _ t   | _ t   | _ t   | _ t   | _ t   | _ t   | _ t   | _ t   | _ t   | _ t   | _ t   | _ t   | _ t   | _ t   | _ t   | _ t   | _ t   | _ t   | _  t   | _! t   | _" t   | _# t   | _$ t   | _% t   | _& t   | _' t   | _( t   | _) t   | _* t   | _+ t   | _, t   | _- t   | _. t   | _/ t   | _0 x? t1 |  j2   D]+ \ } } | j3 d  sP| j4 |  qPqPW| j t5 d  K_ | j t5 d  K_ | j t6 d  j7   K_ | j t6 d  j7   K_ | j t6 d  j7   K_ | j t6 d  j7   K_ | j t6 d  K_ | j' t8 t9 |  j:   K_' | j	 t; t6 d	   | j | j | j t< d
  BK_	 d } | j% t5 d |  K_% | j& t; | j  t8 |  j=  K_& | j. t> | j t8 t9 t?    t@ t5 d  jA   tB   B K_. | j- | j% | j. BjA   K_- | j t5 d  K_ | j t; | j  t8 t9 |  jC   K_ | j tD t; | j  t8 t9 |  jE  t9 |  jF   | j  K_ | j t; | j  t8 t9 |  jG   K_ | j* tH | j  | j K_* | j
 | j jI   K_
 | j$ tD | j tJ | j/  | j  K_$ | j  tD | j tK | j/  | j  K_  | j tD | j* tJ | j/  | j
  K_ | j t; | j  t8 t9 |  jL   K_ | j t; | j  t8 g  |  jL D] } d | ^ q K_ | j tD t; t6 d   | j  | j  t< d  B K_ | j tD t; t6 d   | j  | j  t< d  B K_ | j) tD t; t6 d   | j  | j  t< d  B K_) | j tD t; t6 d   | j  | j  t< d  B K_ | j t8 t9 |  jM   K_ | j t8 t9 |  jN   K_ | j! t8 t9 |  jO   K_! | j" t8 t9 |  jO d h  d g  K_" | j tD t; t6 d   | j tH | j | j Bd d | j | j tH | j | j" Bd d | j | j | j | j | j$ | j  | j  t< d  B K_ | j( tD t; t6 d   tH | j | j | j d d  | j  t< d  B K_( | j tD t; t6 d   | j  t< d   B K_ | j0 t> | j t5 d!   K_0 | j tD t; t6 d"   | j tJ | j# | j0 B | j t< d#  B K_ | j | j& | j B| j- B| j B| j B| j B| j B| j B| j) B| j B| j B| j( B| j B| j BK_ | j# | j' | j	 B| j B| j+ BK_# | j, t8 d d$ g  K_, | j+ tD tH | j  tK | j, | j  tH | j  | j tH | j  B| j B K_+ | j/ | j# | j B| j0 BK_/ | j t; t6 d%   | j | j Bt< d&  BtD tJ | j# | j B  t; t6 d'   | j! | j Bt< d&  BK_ | j tK | j/  K_ | j tQ d( d d) tR K_ | j t5 d*  jA   K_ | j | j tJ | j | j  tB   K_ xZ t1 |  j2   D]F \ } } | j3 d  s.tS |  |  rt| jT tU |  |   qtq.q.W| j |  _V | j |  _W d  S(+   Nu   _u   [-+]?([0-9]+\.?[0-9]*|\.[0-9]+)u   [-+]?[0-9]+u   {u   }u   [u   ]u   \u   \hspaceu   Expected \hspace{n}u   -🿿u;   ([a-zA-Z0-9 +\-*/<>=:,.;!\?&'@()\[\]|%s])|(\\[%%${}\[\]_|])u	   [^A-Za-z]u   '+u   mathu   \fracu   Expected \frac{num}{den}u   \dfracu   Expected \dfrac{num}{den}u	   \stackrelu   Expected \stackrel{num}{den}u   \binomu   Expected \binom{num}{den}u   \}u   \genfract   defaultu    u<   Expected \genfrac{ldelim}{rdelim}{rulesize}{style}{num}{den}u   \sqrtu   Expected \sqrt{value}u	   \overlineu   Expected \overline{value}u	   [A-Za-z]*u   \operatornameu   Expected \operatorname{value}u   ^u   \leftu   Expected a delimiteru   \rightu   $t   unquoteResultsu   (?:(?:\\[$])|[^$])*(X   R   R   t   accentt
   ambi_delimt
   apostrophet
   auto_delimt   binomt   bslasht   c_over_ct   customspacet	   end_groupt   float_literalRa   t   fract   dfract   functiont   genfract   groupt   int_literalt	   latexfontt   lbrackett
   left_delimt   lbracet   mainR4   t   math_stringt   non_matht   operatornamet   overlinet	   placeablet   rbracet   rbrackett   required_groupt   right_delimt   right_delim_safet   simplet   simple_groupt   single_symbolt	   snowflaket   spacet   sqrtt   stackrelt   start_groupt   subsupert
   subsuperopR3   R|   t   tokent   unknown_symbolt   varst   itemsR   t   setNameR   R   t   suppressR   t   listt   _space_widthsR   R  t
   _snowflakeR	   R*   R   t   leaveWhitespaceR   t   _char_over_charsR   t   _accent_mapt   _wide_accentst   _function_namesR   Rp  R   R   t
   _fontnamest   _ambi_delimt   _left_delimt   _right_delimRT   R   R   t   hasattrR  RZ  t   _expressiont   _math_expression(   R=   Rb  R   R   t   unicode_rangeR1  (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR>     s   	%#"+
;+,,,+<
 
 
 
 ,
y
 
"
!f 
Pn- c         C` s   |  j  | d d | |  g |  _ i  |  _ y |  j j |  } WnO t k
 r } t d j d | j d | j	 d d t
 j |  g    n Xd	 |  _ i  |  _ |  j j   | d S(
   u   
        Parse expression *s* using the given *fonts_object* for
        output, at the given *fontsize* and *dpi*.

        Returns the parse tree of :class:`Node` instances.
        u   defaultu   rmu   
u    u    i   u   ^i    N(   t   Statet   _state_stackt   _em_width_cacheR  t   parseStringR   R2   R	  t   linet   columnRt   R  RT   t
   resetCache(   R=   Rc  t   fonts_objectR{   R   Rm   t   err(    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyt   parse	  s    !				R  c           B` sA   e  Z d  Z d   Z d   Z d   Z d   Z e e e  Z RS(   u   
        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.
        c         C` s1   | |  _  | |  _ | |  _ | |  _ | |  _ d  S(   N(   R$  t   _fontR   R{   R   (   R=   R$  Ra   R   R{   R   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR>   	  s
    				c         C` s(   t  j |  j |  j |  j |  j |  j  S(   N(   R  R  R$  Ra   R   R{   R   (   R=   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyRp  	  s    c         C` s   |  j  S(   N(   R  (   R=   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR   	  s    c         C` s%   | d k r | |  _  n  | |  _ d  S(   Nu   rmu   itu   bf(   u   rmu   itu   bf(   R   R  (   R=   R   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyt	   _set_font	  s    (	   RP   RQ   RR   R>   Rp  R   R  t   propertyRa   (    (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR  	  s   				c         C` s   |  j  d S(   u?   
        Get the current :class:`State` of the parser.
        i(   R  (   R=   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyt	   get_state
  s    c         C` s   |  j  j   d S(   u8   
        Pop a :class:`State` off of the stack.
        N(   R  t   pop(   R=   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyt	   pop_state
  s    c         C` s    |  j  j |  j   j    d S(   um   
        Push a new :class:`State` onto the stack which is just a copy
        of the current state.
        N(   R  R   R  Rp  (   R=   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyt
   push_state
  s    c         C` s   t  |  g S(   N(   RP  (   R=   Rc  R  R  (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR  
  s    c         C` s   |  j  j | d d d ! S(   Ni    i   i(   R  R  (   R=   Rc  R  R  (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR  
  s    c         C` s   t  |  } |  j   | g S(   N(   RP  R  (   R=   Rc  R  R  t   hlist(    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR4   
  s    
c         C` st   | d j  d d  } g  | D]! } t | |  j   d t ^ q } t |  } |  j   t d |  j   _ | g S(   Ni    u   \$u   $R4   u   mathtext.default(   t   replaceR9  R  R   RP  R  R   Ra   (   R=   Rc  R  R  R:  t   symbolsR   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR  
  s    .
c         C` s   |  j    } | j | j | j f } |  j j |  } | d  k r | j j | j t	 d d | j | j  } | j
 } | |  j | <n  t | |  S(   Nu   mathtext.defaultu   m(   R  Ra   R{   R   R  R   RT   R$  R   R   R   RT  (   R=   t
   percentageR&  R   R:   R\   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyt   _make_space(
  s    	"	gKqU?u   \,u
   \thinspaceu   \/g0Bxq?u   \>u   \:g%?u   \;g1ZGU?u   \ g      ?u   \enspaceu   \quadu   \qquadgKqUſu   \!c         C` s?   t  |  d k s t  |  j | d } |  j |  } | g S(   Ni   i    (   R   t   AssertionErrorR  R  (   R=   Rc  R  R  R   RM   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR  @
  s    c         C` s   |  j  t | d   g S(   Ni    (   R  R  (   R=   Rc  R  R  (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR  F
  s    c   	      C` sV  | d } y t  | |  j    } Wn' t k
 rL t | | d |   n X| |  j k rx? t j j d | d  D]$ } | | | } | d k rv Pqv qv W| |  j k r t	 | |  j
    d k s | d k s | |  j k r | g St |  j d  | |  j d  g d t g Sn3| |  j k rO| d k rd \ } } x? t j j d | d  D]$ } | | | } | d k r]Pq]q]WxE t j j d t	 |  |  D]$ } | | | } | d k rPqqW| d k r| d
 k r| g Sn  | d k r*| | d j   r*| | d j   r*| g St | |  j d  g d t g Sn  | g S(   Ni    u   Unknown symbol: %si   u    u   {g?RS  u   ,u    u   }u   .(   u    u    (   R9  R  R2   R   t   _spaced_symbolsRt   Ru   t   xranget   _binary_operatorsR   R   R  RP  R  R   t   _punctuation_symbolst   isdigit(	   R=   Rc  R  R  R:  R  R  t	   prev_chart	   next_char(    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR3   I
  sJ    
 ( &
4c         C` s$   | d } t  | | d |   d  S(   Ni    u   Unknown symbol: %s(   R   (   R=   Rc  R  R  R:  (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR  |
  s    
u   itu   Ag      ?u   \circg        u   AAc         C` s  | d } |  j    } | j j | j | j | j  } |  j j | d  \ } } }	 | d  k rp t	 d   n  | j
   }
 | d d  k	 r | d |
 _ n  |
 j | d 9_ t | d |
  } | j
   } | d d  k	 r | d | _ n  | j | d 9_ t | d |  } t | j | j  } t | g  } | j | d  t | g  } | j | d  t | t d | |	  | g  S(   Ni    g        u   Error parsing symboli   i   u   exactly(   NNg        (   R  R$  R   Ra   R{   R   R  R   RT   R   Rp  R?  R9  RY   R:   R|  RQ  Rd  R7  (   R=   Rc  R  R  R   R&  Rj  t
   under_desct	   over_descR  t
   over_statet   overt   under_statet   underR:   t   over_centeredt   under_centered(    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR  
  s4    
	u   \circumflexaccentu   hatu   \combiningbreveu   breveu   \combiningoverlineu   baru   \combininggraveaccentu   graveu   \combiningacuteaccentu   acuteu   \combiningtildeu   tildeu   \combiningdotaboveu   dotu   \combiningdiaeresisu   ddotu   \combiningrightarrowaboveu   vecu   "u   `u   'u   ~u   .u   ^u   \rightarrowu   overrightarrowu
   \leftarrowu   overleftarrowu   mathringu   widehat widetilde widebarc         ` s3   g  t  D](   t   f d   |  D  r   ^ q S(   Nc         3` s*   |  ]  }   j  |  o! |   k Vq d  S(   N(   R   (   t   .0t   a(   Rb  (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pys	   <genexpr>
  s    (   R*   t   any(   t   am(    (   Rb  s2   lib/python2.7/site-packages/matplotlib/mathtext.pyt   <lambda>
  s   c   
      C` s?  t  |  d k s t  |  j   } | j j | j | j | j  } t  | d  d k rj t d   n  | d \ } } | |  j	 k r t
 d | | j | d t } n t |  j | |  } | d k r | j   | j   n  t t | j d  | g  }	 |	 j | j d	  t |	 t d
 | d  t | g  g  S(   Ni   i    i   u   Error parsing accentu   \R  u   mathringg      @u   exactlyg        g       @(   R   R  R  R$  R   Ra   R{   R   R   R  R  R:   R?  R  R/  R|  R8  RQ  Rd  R7  RP  (
   R=   Rc  R  R  R&  Rj  R  R   t
   accent_boxt   centered(    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR  
  s(    	
c         C` sf   |  j    |  j   } d | _ t g  | d D] } t | |  ^ q-  } |  j   | d | _ | S(   Nu   rmi    (   R  R  Ra   RP  R9  R  t   function_name(   R=   Rc  R  R  R&  R:  R   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR  
  s    
	,
c         C` sq   |  j    |  j   } d | _ x7 | d D]+ } t | t  r* d | _ | j   q* q* W|  j   t | d  S(   Nu   rmi    (   R  R  Ra   R   R9  R;  R  RP  (   R=   Rc  R  R  R&  R:  (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR  
  s    
		
c         C` s4   |  j    t |  r0 | d d |  j   _ n  g  S(   Ni    i   (   R  R   R  Ra   (   R=   Rc  R  R  (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR  
  s    
c         C` s   t  | d  } | g S(   Ni    (   RP  (   R=   Rc  R  R  t   grp(    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR  
  s    c         C` s   |  j    g  S(   N(   R  (   R=   Rc  R  R  (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR    s    
c         C` s5   t  |  d k s t  | d } | |  j   _ g  S(   Ni   i    (   R   R  R  Ra   (   R=   Rc  R  R  R   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyRa     s    
c         C` sQ   t  | t  r | j |  j k St  | t  rM t | d  rM | j |  j k St S(   Nu   function_name(	   R   R9  R:  t   _overunder_symbolsRP  R  R  t   _overunder_functionsR   (   R=   R  (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyt   is_overunder  s
    c         C` s#   t  | t  r | j |  j k St S(   N(   R   R9  R:  t   _dropsub_symbolsR   (   R=   R  (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyt
   is_dropsub  s    c         C` s   t  | t  r | j   St S(   N(   R   R9  R=  R   (   R=   R  (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR=    s    
c         C` s   t  S(   N(   R   (   R=   Rc  R  (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyt   is_between_brackets  s    c   %      C` s  t  |  d k s t  d  } d  } d  } d } g  } x{ | d D]o }	 t |	 t j  rx |	 d k rx | t  |	  7} qA t |	 t  r |	 j d k r | d 7} qA | j |	  qA W| } t  |  d k r | s t  t	 d  } nQt  |  d k r| s| d S| d } n$t  |  d k r|t  |  d k rB| d n	 t	 d  } | d	 \ }
 } |
 d k rs| } q8| } n t  |  d k r,t  |  d k r| d n	 t	 d  } | d \ } } } } | | k r| d k rt
 d   qt
 d   n  | d k r| } | } q8| } | } n t
 d   |  j   } | j j | j | j | j  } | j j | j | j | j  } | r| d  k rt g   } n  x6 t |  D]( } | j j |  j | | d g   qW| j   | j   n  |  j |  rng  } d } | j } | d  k	 rF| j   t | | j  } n  | d  k	 rq| j   t | | j  } n  | d  k	 rt | g  } | j | d  | j | t | d  g  n  t | g  } | j | d  | j |  | d  k	 r<t | g  } | j | d  | j t | d  | g  | j } n  t  |  } | | j! | _" t | g  } | g S| } t | t  r| j } t  |  rt | d t  rt# | d	 d  r| d  } n  | d } t# | d  r| j$ j% | _ qn  t | d t& } n0 t | t  r/| j$ j% | _ n  t | g  } t' |  } | j } d } |  j( |  rt| j! } n  | j) | } | j) | } |  j* |  r| | j) | 7} | | j+ | | d d 7} |  j( |  rd | j) | j, | } d | j) | j, | } qd } n  | d  k rt t |  | g  }  |  j   |  j( |  rg| | j- | }! n | j. | }! |! |  _" n,t t |  | g  }  |  j   |  j( |  r| | j- | }" n | j/ | }" | d  k r|" |  _" n t t |  | g  }# |# j   |  j( |  r0| | j- | }! n | j0 | }! d | |" |  j! |# j |! }$ |$ d k rv|" |$ 7}" n  t  |  t |" |  j! |# j |!  |# g  }  |! |  _" |  j( |  s|  j | j1 | 7_ n  t | |  g  } | g S(   Ni   i    u   ^u   _u   'g        i   i   ii   i   iu   Double subscriptu   Double superscriptuO   Subscript/superscript sequence is too long. Use braces { } to remove ambiguity.u   \primeu   exactlyg      @iu   _metricsRS  g       @(   u   ^u   _(   i   i   (   i   i   (2   R   R  RT   R   Rt   Rm  R9  R:  R   R8  R   R  R$  R   Ra   R{   R   R   RP  R   RB  t   extendR3   R>  RQ  R   R:   R/  RY   R|  RT  R;   Rd  R<   RA  R  R<  R   R   R(  R"  R  R=  R  R  R  R  R  R  R  (%   R=   Rc  R  R  R  R  R   t   napostrophest   new_tokst   tokt   opR.  t   op1t   next1t   op2t   next2R&  t   rule_thicknessR   R  t   vlistR  R:   R   Rm   t	   last_charRU  R'  t	   lc_heightt   lc_baselinet	   superkernt   subkernR1  t
   shift_downt   shift_upRh   t   clr(    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR    s   (		(					&
	

 		
		

	


	c         C` s  |  j    } | j j | j | j | j  } t |  } | |  j d k rc | j   | j   n  t	 | g  }	 t	 | g  }
 t
 | j | j  } |	 j | d  |
 j | d  t |	 t d | d  t | |  t d | d  |
 g  } | j j | j t d d | j | j  } |
 j | j | j d | d } | | _ t | t | d  g  g } | sv| r| d	 k rd
 } n  | d	 k rd
 } n  |  j | | |  S| S(   Nu   displaystyleu   exactlyi    g       @u   mathtext.defaultu   =i   g      @u    u   .(   R  R$  R   Ra   R{   R   R  t   _math_style_dictR/  R|  RY   R:   RQ  Rd  R7  Ri  R   R   R;   R^   R`   RA  RP  R8  t   _auto_sized_delimiter(   R=   t   ldelimt   rdelimt   rulet   styleR   t   denR&  Rj  t   cnumt   cdenR:   R.  R\   R  Rm   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyt   _genfrac  s@    	
				c         C` sK   t  |  d k s t  t  | d  d k s4 t  |  j t | d    S(   Ni   i    i   (   R   R  R@  t   tuple(   R=   Rc  R  R  (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR    s    c         C` s   t  |  d k s t  t  | d  d k s4 t  |  j   } | j j | j | j | j  } | d \ } } |  j d d | |  j	 d | |  S(   Ni   i    i   u    u	   textstyle(
   R   R  R  R$  R   Ra   R{   R   R@  R7  (   R=   Rc  R  R  R&  Rj  R   R=  (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR    s    	c         C` s   t  |  d k s t  t  | d  d k s4 t  |  j   } | j j | j | j | j  } | d \ } } |  j d d | |  j	 d | |  S(   Ni   i    i   u    u   displaystyle(
   R   R  R  R$  R   Ra   R{   R   R@  R7  (   R=   Rc  R  R  R&  Rj  R   R=  (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR    s    	c         C` sg   t  |  d k s t  t  | d  d k s4 t  | d \ } } |  j d d d |  j d | |  S(   Ni   i    i   u    g        u	   textstyle(   R   R  R@  R7  (   R=   Rc  R  R  R   R=  (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR  #  s
    c         C` sg   t  |  d k s t  t  | d  d k s4 t  | d \ } } |  j d d d |  j d | |  S(   Ni   i    i   u   (u   )g        u	   textstyle(   R   R  R@  R7  (   R=   Rc  R  R  R   R=  (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR  +  s
    c         C` s  | d \ } } |  j    } | j j | j | j | j  } | j | j | d } | j | j }	 t	 d | |	 | d t
 }
 |
 j |
 j } |
 j |
 j }	 t t | d  | t | d  g  } t t |  t   | g  } | j | | j | j d d |	  | d  k r4t |
 j d	 d
 d
  } n< t g  | D] } t | |  ^ q> } | j   | j   t t | g  g  } | d | _ t | t |
 j d	  |
 | g  } | g S(   Ni    g      @u	   \__sqrt__R  g       @g      Y@g      (@u   exactlyg      ?g        g333333?g     @(   R  R$  R   Ra   R{   R   R;   RA  R<   R  R   RP  R8  Rd  Ri  Rv  Re  RT   R3  R:   R9  R/  RT  (   R=   Rc  R  R  t   roott   bodyR&  Rj  R;   R<   t   checkt   padded_bodyt	   rightsideR1  t
   root_vlistR   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR  3  s:    	
(

c         C` s   t  |  d k s t  t  | d  d k s4 t  | d d } |  j   } | j j | j | j | j  } | j | j	 | d } | j
 | j	 } t t |  t   t | g  g  }	 |	 j | | j | j d d |  t |	 g  }
 |
 g S(   Ni   i    g      @g      Y@g      (@u   exactlyg     @(   R   R  R  R$  R   Ra   R{   R   R;   RA  R<   Rd  Ri  Rv  RP  Re  (   R=   Rc  R  R  RC  R&  Rj  R;   R<   RF  R   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR  _  s    	
c   
      C` s   |  j    } t |  rM t d   | D  } t d   | D  } d  } n d } d } d } g  } | d k r | j t | | | | d |  n  | j |  | d k r | j t | | | | d |  n  t |  }	 |	 S(   Nc         s` s   |  ] } | j  Vq d  S(   N(   R;   (   R  R1  (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pys	   <genexpr>{  s    c         s` s   |  ] } | j  Vq d  S(   N(   R<   (   R  R1  (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pys	   <genexpr>|  s    i    g      ?u   .R  (   R  R   RY   RT   R   R  R$  RP  (
   R=   t   frontt   middlet   backR&  R;   R<   R  t   partsR   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR8  x  s     	%%c         C` s(   | \ } } } |  j  | | j   |  S(   N(   R8  t   asList(   R=   Rc  R  R  RH  RI  RJ  (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR    s    (   u   itu   Ag      ?N(   Nu   \circg      ?(D   RP   RQ   RR   R   R7  R   R   R  t   _relation_symbolst   _arrow_symbolsR  R	  R  R  R!  R  R  R  R  R  R>   R  t   objectR  R  R  R  R  R  R4   R  R  R  R  R  R3   R  R  RT   R  R  R  R  R  R  R  R  R  R  R  R  R  Ra   R   R"  R=  R#  R  R@  R  R  R  R  R  R  R  R8  R  (    (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR    s   											

			1		%
						
								*						,		t   MathTextParserc           B` s   e  Z d Z i e d  6e d 6e d 6e d 6e d 6e	 d 6e
 d 6e d 6Z i e d 6e d	 6e d
 6e d 6e d 6e d 6Z d   Z d d d  Z d d d  Z d d d d  Z d d d d  Z d d d  Z RS(   u   bitmapu   aggu   psu   pdfu   svgu   pathu   cairou   macosxu   cmu   dejavuserifu
   dejavusansu   stixu   stixsansu   customc         C` s"   | j    |  _ t d  |  _ d S(   uI   
        Create a MathTextParser for the given backend *output*.
        i2   N(   R   t   _outputR!   t   _cache(   R=   t   output(    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR>     s    iH   c         C` sZ  | d k r t   } n  | | t |  f } |  j j |  } | d k	 rO | S|  j d k rw t d rw t |  } n_ |  j |  j   } t d } |  j	 j | j
    }	 |	 d k	 r |	 | |  } n t d   | j   }
 |  j d k rt   |  j _ n  |  j j | | |
 |  } | j | j | j | j  | j |  } | |  j | <| S(   u  
        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.
        u   psu	   ps.useafmu   mathtext.fontsetub   mathtext.fontset must be either 'cm', 'dejavuserif', 'dejavusans', 'stix', 'stixsans', or 'custom'N(   RT   R&   t   hashRR  R   RQ  R   R  t   _backend_mappingt   _font_type_mappingR   R2   t   get_size_in_pointst   _parserR  R-  R  RB   R:   R;   R<   RN   (   R=   Rc  R   R   t   cacheKeyRm   R$  t   backendt   fontsett   fontset_classR{   RM   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyR    s.    
	ix   i   c         C` s[   |  j  d k s t  t d |  } |  j | d | d | \ } } | j   } | | f S(   u  
        *texstr*
            A valid mathtext string, e.g., 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.
        u   bitmapR*  R   R   (   RQ  R  R&   R  t   as_array(   R=   t   texstrR   R{   R   t   ftimageR<   R1  (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyt   to_mask  s
    !u   blackc         C` s   |  j  | d | d | \ } } t j |  \ } } }	 }
 t j | j d | j d d f d t j } d | | d d  d d  d f <d | | d d  d d  d f <d |	 | d d  d d  d	 f <| | d d  d d  d
 f <| | f S(   u  
        *texstr*
            A valid mathtext string, e.g., 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   R{   i    i   i   t   dtypei   Ni   i   (   R`  t   mcolorst   to_rgbaRY  t   zerost   shapet   uint8(   R=   R^  t   colorR   R{   R1  R<   t   rt   gt   bR  t   RGBA(    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyRc    s    !/###c         C` s;   |  j  | d | d | d | \ } } t j | |  | S(   u;  
        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, e.g., 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.
        Rg  R   R{   (   Rc  R   t	   write_png(   R=   R   R^  Rg  R   R{   t   rgbaR<   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyt   to_png  s    'c         C` sI   |  j  d k s t  t d |  } |  j | d | d | \ } } | S(   u.  
        Returns the offset of the baseline from the bottom of the
        image in pixels.

        *texstr*
            A valid mathtext string, e.g., r'IQ: $\sigma_i=15$'

        *dpi*
            The dots-per-inch to render the text

        *fontsize*
            The font size in points
        u   bitmapR*  R   R   (   RQ  R  R&   R  (   R=   R^  R   R{   R   R_  R<   (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyt	   get_depth:  s    !N(   RP   RQ   RT   RX  Rq   RS   Rs   R   R   R   R   RU  R   R   R   R   R   R   RV  R>   R  R`  Rc  Rn  Ro  (    (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyRP    s.   

	/ c         C` s   d d l  m } d d l m } | d k r8 t   } n  t d  } | j |  d d d | \ } }	 }
 } } | j d | d	 |	 d	 f  } | j	 d |
 |	 |  d
 | | j
 |  | j | d | d | |
 S(   u  
    Given a math expression, renders it in a closely-clipped bounding
    box to an image file.

    *s*
       A math expression.  The math portion should be enclosed in
       dollar signs.

    *filename_or_obj*
       A filepath or writable file-like object to write the image data
       to.

    *prop*
       If provided, a FontProperties() object describing the size and
       style of the text.

    *dpi*
       Override the output dpi, otherwise use the default associated
       with the output format.

    *format*
       The output format, e.g., 'svg', 'pdf', 'ps' or 'png'.  If not
       provided, will be deduced from the filename.
    i    (   t   figure(   Rn   u   pathR   iH   R   t   figsizeg      R@t   fontpropertiesR  N(   t
   matplotlibRp  Ro   Rn   RT   R&   RP  R  t   Figuret   textt   FigureCanvasAggt   savefig(   Rc  t   filename_or_objR   R   R  Rp  Rn   t   parserR:   R;   R<   t   _t   fig(    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyt   math_to_imageM  s    * (   RR   t
   __future__R    R   R   R   Rt   R   R   R4   R   R   t   warningsR   t   numpyR   R   RY  t	   pyparsingR	   R
   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   t   enablePackratRs  R   R   Rb  R   R   t   matplotlib.afmR   t   matplotlib.cbookR   R    R!   t   matplotlib.ft2fontR"   R#   R$   t   matplotlib.font_managerR%   R&   R'   t   matplotlib._mathtext_dataR(   R)   R*   R+   R,   R   R6   R8   RO  R9   RS   Rq   Rs   R   R   R   R   R   R   R   R   R   R   R   R   R   R  R5  R6  R4  R  R  R  R   R!  R"  R#  R(  t   WarningR   R)  R3  R7  R8  R9  R?  R@  RP  Rd  Rh  Ri  Rk  R[  Rn  Rr  Ru  Rv  Rw  Rx  Ry  Rz  R{  R|  R}  RT  R~  R  R  R  Ri   R  R  RP  RT   R|  (    (    (    s2   lib/python2.7/site-packages/matplotlib/mathtext.pyt   <module>   s   "p
"(		6J(ipr+w
$	
	!N=oJ	!	%		   