+
     ]i3  c                   s    ^ RI Ht ^ RIt^ RIt^ RIt^ RIHtH	t	 ^ RI
HtHtHt ^ RIHt ^ RIHt ^ RIHt ^ RIHt ^ R	IHt ]P2                  ! ]4      t ! R
 R4      t]! 4       t ! R R]4      tR# )    )OrderedDictN)_text_helpersdviread)FontPropertiesget_fontfontManager)	LoadFlags)MathTextParser)Path)
TexManager)Affine2Dc                   s   a  ] tR t^t o RtRt^HtR tR tR t	R t
R tRR ltRR
 ltRR ltRR lt]R 4       tRtV tR	# )
TextToPathz'A class that converts strings to paths.g      Y@c                s4    \        R 4      V n        RV n        R# )ZpathN)r   mathtext_parser_texmanagerself   &:/usr/lib64/python3.14/site-packages/matplotlib/textpath.py__init__ZTextToPath.__init__   s    -f5    c                s    \         P                  ! V4      p\        V4      pVP                  V P                  V P
                  4       V# )zH
Find the `FT2Font` matching font properties *prop*, with its size set.
)_fontManagerZ_find_fonts_by_propsr   set_size
FONT_SCALEDPI)r   propZ	filenamesfonts   &&  r   	_get_fontZTextToPath._get_font   s9     !55d;		"dootxx0r   c                s"    \         P                  # )N)r   
NO_HINTINGr   r   r   _get_hinting_flagZTextToPath._get_hinting_flag'   s    ###r   c                s`    \         P                  P                  VP                   RVR 24      # )z?
Return a unique id for the given font and character-code set.
Z-x)urllibparseZquoteZpostscript_name)r   r   ccodes   &&&r   _get_char_idZTextToPath._get_char_id*   s-     ||!!T%9%9$:!E!9"EFFr   c                sf   VP                  4       pVR 8X  d   \        4       P                  W4      # W@P                  ,          pV'       db   VP	                  4       pVP                  V P                  4       V P                  P                  V^HV4      vrgrWe,          Wu,          W,          3# V P                  V4      p
V
P                  VR\        P                  R7       V
P                  4       w  rVR,          pVR,          pV
P                  4       pVR,          pW,          W,          W,          3# )TeXg        flagsg      P@)get_size_in_pointsr
   get_text_width_height_descentr   copyr   r   r    r   Zset_textr   r   Zget_width_heightZget_descent)r   sr   ismathfontsizescalewidthheightdescentZ_r   whZds   &&&&          r   r'   Z(TextToPath.get_text_width_height_descent0   s    **,U?<==aJJ??*99;DMM$//*$$**1b$7 'E7=&.'/AA~~d#aI$8$89$$&	T		T		T	y!)QY..r   c                s   VR8X  d   V P                  W4      w  rEpMBV'       g'   V P                  V4      pV P                  Wr4      w  rEpMV P                  W4      w  rEp. . rV F@  w  rrWZ,          w  rVP	                  W,          W.,           4       V	P	                  V4       KB  	  V F'  w  rVP	                  V4       V	P	                  V4       K)  	  V'       g   \
        P                  ! R4      pW3# )a  
Convert text *s* to path (a tuple of vertices and codes for
matplotlib.path.Path).

Parameters
----------
prop : `~matplotlib.font_manager.FontProperties`
    The font properties for the text.
s : str
    The text to be converted.
ismath : {False, True, "TeX"}
    If True, use mathtext parser.  If "TeX", use tex for rendering.

Returns
-------
verts : list
    A list of arrays containing the (x, y) coordinates of the vertices.
codes : list
    A list of path codes.

Examples
--------
Create a list of vertices and codes from a text, and create a `.Path`
from those::

    from matplotlib.path import Path
    from matplotlib.text import TextToPath
    from matplotlib.font_manager import FontProperties

    fp = FontProperties(family="Comic Neue", style="italic")
    verts, codes = TextToPath().get_text_path(fp, "ABC")
    path = Path(verts, codes, closed=False)

Also see `TextPath` for a more direct way to create a path from a text.
r#   )r    i   )get_glyphs_texr   get_glyphs_with_fontget_glyphs_mathtextZextendnpZempty)r   r   r)   r*   Z
glyph_info	glyph_maprectsr   ZvertscodesZglyph_idZ	xpositionZ	ypositionr,   Zverts1Zcodes1s   &&&&            r   get_text_pathZTextToPath.get_text_pathH   s    H U?+/+>+>t+G(J5>>$'D+/+D+DT+M(J5+/+C+CD+L(J52u5?1H&0NFLL9*@@ALL  6@ $NFLL LL  $ HHV$E|r   Nc                s   Vf   \        4       pV'       d   \        4       pMTp. p. p\        P                  ! W!4       F  pV P                  VP                  \        VP                  4      4      p	VP                  V	4       VP                  VP                  4       W9  g   Kf  VP                  P                  4       WY&   K  	  ^ .\        V4      ,          p
R.\        V4      ,          p. p\        \        WvW4      4      W\3# )zG
Convert string *s* to vertices and codes using the provided ttf font.
g      ?)r   r   Zlayoutr"   Z	ft_objectZordZcharappendr   get_pathZlenlistzip)r   r   r)   r6   return_new_glyphs_onlyglyph_map_new
xpositions	glyph_idsZitemchar_id
ypositionssizesr7   s   &&&&&        r   r3   ZTextToPath.get_glyphs_with_font   s     #I!'MM%M
	!((1D''DIIGGW%dff%')-)@)@)B& 2 S3z?*
s:&S
BC& 	&r   c                sf   VP                  4       pVP                  V P                  4       V P                  P	                  W P
                  V4      w  rVrxp	V'       g   \        4       pV'       d   \        4       p
MTp
. p. p. p. pV F  w  pppppV P                  VV4      pVV9  dk   VP                  4        VP                  V P                  V P
                  4       VP                  V\        P                  R7       VP                  4       V
V&   VP                  V4       VP                  V4       VP                  V4       VV P                  ,          pVP                  V4       K  	  . pV	 F  w  ppppVV3VVV,           3VV,           VV,           3VV,           V3VV3R.p\        P                  \        P                   \        P                   \        P                   \        P                   \        P"                  .pVP                  VV34       K  	  \%        \'        WW4      4      V
V3# )zG
Parse mathtext string *s* and convert it to a (vertices, codes) pair.
r$   r    r    )r(   r   r   r   r    r   r   r"   clear	load_charr   r   r;   r:   r	   MOVETOLINETO	CLOSEPOLYr<   r=   )r   r   r)   r6   r>   r-   r.   r/   Zglyphsr7   r?   r@   rC   rA   rD   r   r+   r!   oxoyrB   sizemyrectsr0   r1   vert1code1s   &&&&&                      r   r4   ZTextToPath.get_glyphs_mathtext   s    yy{doo&040D0D0J0Jxx1-w #I!'MM%M

	-3)D(E2r''e4Gi'

dootxx8uI,@,@A)-g&b!b!W%doo-DLL .4 !LBAq"XBF|b1fb1f-=1fb\B8V5E[[[[$++t{{DKK^^%E NNE5>* " S
BCw( 	(r   c                s6   \        4       P                  W P                  4      p\        P                  ! WPP
                  4      ;_uu_ 4       pVw  pRRR4       Vf   \        4       pV'       d   \        4       pMTp. . . . 3w  rrXP                   EF  p\        VP                  4      pV P                  WP                  4      pW9  d   VP                  4        VP                  V P                  V P
                  4       VP                  p\        V\         4      '       d4   VP#                  V4      pVP%                  V\&        P(                  R7       MX\        V\*        4      '       d4   V P-                  V4       VP/                  V\&        P(                  R7       M\1        RV: 24      hVP3                  4       W&   V	P5                  V4       V
P5                  VP6                  4       VP5                  VP8                  4       VP5                  VP:                  V P                  ,          4       EK  	  . pVP<                   F  w  ppppVV3VV,           V3VV,           VV,           3VVV,           3VV3R.p\>        P@                  \>        PB                  \>        PB                  \>        PB                  \>        PB                  \>        PD                  .pVP5                  VV34       K  	  \G        \I        WW4      4      VV3#   + '       g   i     EL; i)z?Convert the string *s* to vertices and codes using usetex mode.Nr$   zGlyph spec of unexpected type: rE   )%r
   Zmake_dvir   r   ZDvir   r   textr   Z	font_pathr"   ZglyphrF   r   glyph_name_or_indexZ
isinstanceZstrZget_name_indexZ
load_glyphr   ZTARGET_LIGHTZint_select_native_charmaprG   Z	TypeErrorr;   r:   r   ZyZ	font_sizeZboxesr	   rH   rI   rJ   r<   r=   )r   r   r)   r6   r>   ZdvifileZdviZpager?   rA   r@   rC   rD   rQ   r   rB   rR   ZindexrN   rK   rL   r1   r0   rO   rP   s   &&&&&                    r   r2   ZTextToPath.get_glyphs_tex   sx   
 ,''??;[[((++sED , #I!'MM%M35r2r>0	z IIDDNN+D''jj9G'

dootxx8&*&>&>#1377 //0CDEOOE1G1GOH 3S99//5NN+93I3I # K $&E':&=%? @ @)-&W%dff%dff%LL$//9:- 0  JJLBAq"XQ|b1fb1f-="q&\B8V5E[[[[$++t{{DKK^^%E NNE5>* ' S
BCw( 	(c ,++s   LL	c                s    R F  p V P                  V4        R# 	  \        P	                  RV P
                  4       R#   \        \        3 d     KP  i ; i)CBDAz#No supported encoding in font (%s).N)rT   iBODA)Zselect_charmapZ
ValueErrorZRuntimeError_logZwarningZfname)r   Zcharmap_code   & r   rS   Z!TextToPath._select_native_charmap  sT    
L##L1 
 LL>

K - s   ?AA)r   r   )F)NF)__name__
__module____qualname____firstlineno____doc__r   r   r   r   r   r"   r'   r9   r3   r4   r2   ZstaticmethodrS   __static_attributes____classdictcell__)__classdict__s   @r   r   r      sY     1J
C $G/0:x&>1(f8(t L Lr   r   c                   sl   a a ] tR tRt oRtR
V 3R lltR tR t]R 4       t	]R 4       t
R tR	tVtV ;t# )TextPathi%  z
Create a path from the text.
c                s4  < ^ RI Hp \        P                  ! V4      pVf   VP	                  4       pWn        V P                  V4       RV n        V! VR7      P                  V4      w  r(\        S	V `(  ! \        P                  WBVR7      RVRR/  RV n        R# )	a
  
Create a path from the text. Note that it simply is a path,
not an artist. You need to use the `.PathPatch` (or other artists)
to draw this path onto the canvas.

Parameters
----------
xy : tuple or array of two float values
    Position of the text. For no offset, use ``xy=(0, 0)``.

s : str
    The text to convert to a path.

size : float, optional
    Font size in points. Defaults to the size specified via the font
    properties *prop*.

prop : `~matplotlib.font_manager.FontProperties`, optional
    Font property. If not provided, will use a default
    `.FontProperties` with parameters from the
    :ref:`rcParams<customizing-with-dynamic-rc-settings>`.

_interpolation_steps : int, optional
    (Currently ignored)

usetex : bool, default: False
    Whether to use tex rendering.

Examples
--------
The following creates a path from the string "ABC" with Helvetica
font face; and another path from the latex fraction 1/2::

    from matplotlib.text import TextPath
    from matplotlib.font_manager import FontProperties

    fp = FontProperties(family="Helvetica", style="italic")
    path1 = TextPath((12, 12), "ABC", size=12, prop=fp)
    path2 = TextPath((0, 0), r"$\frac{1}{2}$", size=12, usetex=True)

Also see :doc:`/gallery/text_labels_and_annotations/demo_text_path`.
)TextN)usetex)r*   _interpolation_stepsZreadonlyTF)Zmatplotlib.textr`   r   Z	_from_anyr&   _xyr   _cached_verticesZ_preprocess_mathZsuperr   text_to_pathr9   _should_simplify)
r   Zxyr)   rM   r   rb   ra   r`   r*   	__class__s
   &&&&&&&  r   r   ZTextPath.__init__*  s    Z 	)''-<**,Dd $'88;	'''?	!5	 	 !&r   c                s     Wn         RV n        R# )zSet the text size.TN)_size_invalid)r   rM   s   &&r   r   ZTextPath.set_sizeh  s    
r   c                    V P                   # )zGet the text size.)rh   r   r   r   get_sizeZTextPath.get_sizem  s    zzr   c                s:    V P                  4        V P                  # )z8
Return the cached path after updating it if necessary.
)_revalidate_pathrd   r   r   r   verticesZTextPath.verticesq  s    
 	$$$r   c                rj   )z
Return the codes
)Z_codesr   r   r   r8   ZTextPath.codesy  s    
 {{r   c                sn   V P                   '       g   V P                  f   \        4       P                  V P                  \
        P                  ,          4      P                  ! V P                  !  pVP                  V P                  4      V n        RV P                  P                  n        RV n         R# R# )z
Update the path if necessary.

The path for the text is initially create with the font size of
`.FONT_SCALE`, and this path is rescaled to other size when necessary.
NF)ri   rd   r   r,   rh   re   r   Z	translaterc   Z	transformZ	_verticesr%   Z	writeable)r   ZtrrV   r   rl   ZTextPath._revalidate_path  s     ===D119*5l&=&==>9"hh(B %'LL$@D!49D!!''1!DM :r   )rd   ri   rf   rh   rc   )NNi   F)rW   rX   rY   rZ   r[   r   r   rk   Zpropertyrm   r8   rl   r\   r]   Z__classcell__)rg   r^   s   @@r   r_   r_   %  sL     <&|
 % %  " "r   r_   )Zcollectionsr   ZloggingZurllib.parser   Znumpyr5   Z
matplotlibr   r   Zmatplotlib.font_managerr   r   r   r   Zmatplotlib.ft2fontr   Zmatplotlib.mathtextr   Zmatplotlib.pathr	   Zmatplotlib.texmanagerr
   Zmatplotlib.transformsr   Z	getLoggerrW   rU   r   re   r_   ) r   r   <module>rn      se    #    -  ) .   , *"KL KL\ |h"t h"r   