
    h3                       S r SSKJr  SSKJr  SSKrSSKrSSKJr  SSKrSSK	J
r
  SSKrSSKrSSKJr  SSKrSSKJr  SSKrSSKrSSKrSSKrSSKrSSKrSS	KJrJrJrJr  SS
KJrJr  SSK J!r!  \RD                  " \#5      r$SSSSSSSSSSS.
r%SSSSSSSSSSSSSS.r&SSSSSSSSSSSSSSS.r'/ SQr(1 S kr) \RT                  " 5       r+S!r.S"S#/r/\0" \+S$-  5      \0" \+S%-  5      /r1S&S'S(S)S*\0" \" \Rd                  Rg                  S+5      =(       d    \+S,-  5      S--  5      \0" \+S.-  5      /r4S/S0S1S2\0" \+S3-  5      /r5S4 r6S5 r7S6 r8S7 r9\S8 5       r:\S9 5       r;STS: jr<\Rz                  " S;S<9 " S= S>5      5       r>S? r?S@ r@SA rA " SB SC5      rB " SD SE\R                  5      rDSF rESG rFSH rG " SI SJ5      rH\SK 5       rI\" SL5      SM 5       rJ\K" \SN5      (       a  \R                  " \JR                  SO9  \" SL5      SP 5       rNSUSQ jrOS;SR.SS jrP\P" 5       rQ\QR                  rR\QR                  rSg! \, a    \" \RZ                  5      r+ GN~f = f)Va  
A module for finding, managing, and using fonts across platforms.

This module provides a single `FontManager` instance, ``fontManager``, that can
be shared across backends and platforms.  The `findfont`
function returns the best TrueType (TTF) font file in the local or
system font path that matches the specified `FontProperties`
instance.  The `FontManager` also handles Adobe Font Metrics
(AFM) font files for use by the PostScript backend.
The `FontManager.addfont` function adds a custom font from a file without
installing it into your operating system.

The design is based on the `W3C Cascading Style Sheet, Level 1 (CSS1)
font specification <http://www.w3.org/TR/1998/REC-CSS2-19980512/>`_.
Future versions may implement the Level 2 or 2.1 specifications.
    )annotations)	b64encodeN)	lru_cache)BytesIO)Number)Path)_api_afmcbookft2font)parse_fontconfig_patterngenerate_fontconfig_pattern)_validatorsgI+?gh|?5?g-?      ?g333333?g
ףp=
?gS?)
zxx-smallzx-smallsmallmediumlargezx-largezxx-largelargersmallerNd      ,      X         )zultra-condensedzextra-condensed	condensedsemi-condensednormalzsemi-expandedzsemi-extendedexpandedextendedzextra-expandedzextra-extendedzultra-expandedzultra-extended)
ultralightlightr!   regularbookr   romansemibolddemibolddemiboldheavyz
extra boldblack))thinr   )
extralightr   )r$   r   )	demilight^  )	semilightr2   )r%   r   )r'   i|  )r&   r   )r!   r   )r   r   )r*   r   )r+   r   )r)   r   )	extraboldr   )	superboldr   )	ultraboldr   )r,   r   )
ultrablack  )
superblackr8   )
extrablackr8   )z\bultrar8   )r.   r   )r-   r   >   sansserifcursivefantasy	monospace
sans serif
sans-serifz@Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Foldersz2SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fontsz/SOFTWARE\Microsoft\Windows\CurrentVersion\Fontsz%AppData/Local/Microsoft/Windows/Fontsz'AppData/Roaming/Microsoft/Windows/Fontsz/usr/X11R6/lib/X11/fonts/TTF/z/usr/X11/lib/X11/fontsz/usr/share/fonts/z/usr/local/share/fonts/z)/usr/lib/openoffice/share/fonts/truetype/XDG_DATA_HOMEz.local/sharefontsz.fontsz/Library/Fonts/z/Network/Library/Fonts/z/System/Library/Fonts/z/opt/local/share/fontszLibrary/Fontsc                $    S// SQ/ SQ/ SQS.U    $ )z\
Return a list of file extensions that are synonyms for
the given file extension *fileext*.
afm)otfttcttf)rE   rF   rG   rH    fontexts    I/var/www/html/env/lib/python3.13/site-packages/matplotlib/font_manager.pyget_fontext_synonymsrM      s&     w$$$	
      c                F   U Vs/ s H  nSU-   PM
     nn[         R                  " U 5       VVVVs/ s HX  u  p4nU  HK  n[        U5      R                  R	                  5       U;   d  M,  [         R
                  R                  X65      PMM     MZ     snnnn$ s  snf s  snnnnf )zc
Return a list of all fonts matching any of the extensions, found
recursively under the directory.
.)oswalkr   suffixlowerpathjoin)	directory
extensionsextdirpath_	filenamesfilenames          rL   
list_fontsr^      s    
 (22z#)zJ2 *,);<);%I%H~$$**,
:	 ,BGGLL+ & ,);< < 3<s   B4B
)'B
c                 .   SSK n  U R                  U R                  [        5       nU R	                  US5      S   sSSS5        $ ! , (       d  f       g= f! [
         a4    [        R                  R                  [        R                  S   S5      s $ f = f)z
Return the user-specified font directory for Win32.  This is
looked up from the registry key ::

  \\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Fonts

If the key is not found, ``%WINDIR%\Fonts`` will be returned.
r   NFontsWINDIR)
winregOpenKeyHKEY_CURRENT_USER	MSFoldersQueryValueExOSErrorrQ   rU   rV   environ)rb   users     rL   win32FontDirectoryrj      sp     ;^^F44i@D&&tW5a8 A@@ ;ww||BJJx0'::;s-    A A	A 
AA A ;BBc            	     P   SSK n [        5       nU R                  [        5       /4U R                  [
        44 H  u  p#U H  n[         H  n U R                  X%5       n[        U R                  U5      S   5       HY  nU R                  Xg5      u  pn
[        U	[        5      (       d  M.   [        XI5      R                  5       nUR!                  U5        M[     SSS5        M     M     M     U$ ! [         a     M  f = f! , (       d  f       M  = f! ["        [$        4 a     M  f = f)z2List the font paths known to the Windows registry.r   N   )rb   setHKEY_LOCAL_MACHINErj   rd   MSUserFontDirectoriesMSFontDirectoriesrc   rangeQueryInfoKey	EnumValue
isinstancestrr   resolveRuntimeErroraddrg   MemoryError)rb   itemsdomain	base_dirsbase_dirreg_pathlocaljkeyvaluetprU   s               rL   _get_win32_installed_fontsr      s   EE &&);)=(>?%%'<= "H-9U!&v':':5'A!'D!EA .4-=-=e-GNC#-eS#9#9 () (,H'<'D'D'F "IIdO "F :9 . "	0 L $0 ) () :9  - sU   DAC?	*C.
C?	D.
C<8C?	;C<<C?	?
D	DDD%	$D%	c                 f    S[         R                  " SS/5      ;  a  [        R                  S5        / $ [         R                  " SS/5      n U R                  S5       Vs/ s H"  n[        [        R                  " U5      5      PM$     sn$ ! [        [         R
                  4 a    / s $ f = fs  snf )z3Cache and list the font paths known to ``fc-list``.s   --formatzfc-listz--helpz7Matplotlib needs fontconfig>=2.7 to query system fonts.z--format=%{file}\n   
)

subprocesscheck_output_logwarningrg   CalledProcessErrorsplitr   rQ   fsdecode)outfnames     rL   _get_fontconfig_fontsr      s    j55y(6KLLLLIKI%%y2G&HI 36))E2BC2BDU#$2BCC Z223 	Cs   2B B  )B.B+*B+c                     [         R                  " [        R                  " / SQ5      5      u  n U S    Vs/ s H  n[        US   5      PM     sn$ ! [        [        R
                  [         R                  4 a    / s $ f = fs  snf )zKCache and list the font paths known to ``system_profiler SPFontsDataType``.)system_profilerz-xmlSPFontsDataType_itemsrU   )plistlibloadsr   r   rg   r   InvalidFileExceptionr   )dentrys     rL   _get_macos_fontsr     sv    ^^##$RSU ./x[9[EDv[99 Z22H4Q4QR 	9s   .A B+B ?B c           
     f  ^ [        5       n[        U5      mU c}  [        R                  S:X  a  [	        5       n/ n O@[        5       n[        R                  S:X  a  U[        5       -  n/ [        Q[        Qn O[        n UR                  U4S jU 5       5        O[        U [        5      (       a  U /n U  H@  nUR                  [        [        R                  R                  [!        UT5      5      5        MB     U Vs/ s H+  n[        R                  R#                  U5      (       d  M)  UPM-     sn$ s  snf )a  
Search for fonts in the specified font paths.  If no paths are
given, will use a standard set of system paths, as well as the
list of fonts tracked by fontconfig if fontconfig is installed and
available.  A list of TrueType fonts are returned by default with
AFM fonts as an option.
win32darwinc              3     >#    U  H3  nUR                   R                  5       S S T;   d  M&  [        U5      v   M5     g7f)rl   N)rS   rT   ru   ).0rU   fontextss     rL   	<genexpr>"findSystemFonts.<locals>.<genexpr>)  s;      At KK--/3x? #Ts   %>>)rm   rM   sysplatformr   r   r   X11FontDirectoriesOSXFontDirectoriesupdatert   ru   maprQ   rU   abspathr^   exists)	fontpathsrK   	fontfilesinstalled_fontsrU   r   r   s         @rL   findSystemFontsr     s     I#G,H<<7"8:OI35O||x'#3#55F0F3EF	.	 A A 	A 
Is	#	#K	RWW__jx.HIJ   )ByeBGGNN5,AEyBBBs   9(D.%D.T)frozenc                      \ rS rSr% SrSrS\S'   SrS\S'   SrS\S'   Sr	S\S	'   Sr
S
\S'   SrS\S'   SrS\S'   SS jrSS jrSrg)	FontEntryi5  z^
A class for storing Font properties.

It is used when populating the font lookup dictionary.
 ru   r   namer!   stylevariantz	str | intweightstretchr   sizec                `    U R                  5       n[        U5      R                  5       nSU S3$ )Nz!<img src="data:image/png;base64, z" />)
_repr_png_r   decode)self
png_streampng_b64s      rL   _repr_html_FontEntry._repr_html_E  s0    __&
J'..03G9EBBrN   c                .   SSK Jn  U" 5       nU R                  S:w  a  [        U R                  5      OS nUR	                  SSU R
                  US9  [        5        nUR                  USSS9  UR                  5       sS S S 5        $ ! , (       d  f       g = f)Nr   )Figurer   )fonttightT)bbox_inchestransparent)	matplotlib.figurer   r   r   textr   r   savefiggetvalue)r   r   fig	font_pathbufs        rL   r   FontEntry._repr_png_J  sk    ,h(,

b(8D$d	Atyyy1Y#KKdKC<<> YYs   !B
BrI   N)returnru   )r   bytes)__name__
__module____qualname____firstlineno____doc__r   __annotations__r   r   r   r   r   r   r   r   __static_attributes__rI   rN   rL   r   r   5  sX     E3OD#NE3GS FI GSD#C
"rN   r   c           	     T  ^ ^^ T R                   nT R                  5       nSnSnUR                  / UQSP7S5      R                  S5      R	                  5       =(       d4    UR                  / UQSP7S5      R                  S5      R	                  5       nUR                  / UQSP7S5      R                  S5      R	                  5       =(       d4    UR                  / UQSP7S5      R                  S5      R	                  5       mTR                  S5      S	:  a  SnO]TR                  S
5      S	:  a  S
nOEUR                  S5      S	:  a  SnO-[        R                  R                  T R                  ;   a  S
nOSnUR	                  5       S;   a  SnOSnSnSn	Sn
UR                  / UQUP7S5      R                  S5      UR                  / UQU	P7S5      R                  S5      UR                  / UQU
P7S5      R                  S5      UR                  / UQUP7S5      R                  S5      UR                  / UQU	P7S5      R                  S5      UR                  / UQU
P7S5      R                  S5      /m/ [        ST5      Q=(       d    T R                  /mU U4S jn[        U" 5       5      n[        U4S jS 5       5      (       a  SnO(ST;   a  SnO[        U4S jS 5       5      (       a  SnOSnT R                  (       d  [        S5      eSn[!        T R"                  XX|X5      $ )z
Extract information from a TrueType font file.

Parameters
----------
font : `.FT2Font`
    The TrueType font file from which information will be extracted.

Returns
-------
`FontEntry`
    The extracted font properties.

)rl   r   r   )   rl   i	     rN   zlatin-1	utf_16_be   obliquer   italicr&   r!   capitals
small-capsr         z	utf-16-beNc                 L  > TR                  S5      n U (       a  U S   S:w  a  U S   $  TR                  5       S   R                  SS5      =(       d    Sn[         H3  u  p#[        R
                  " X![        R                  5      (       d  M1  Us  $    T HT  nUR                  SS5      n[         H5  u  p#[        R                  " X$[        R                  5      (       d  M1  Us  s  $    MV     [        R                  R                  TR                  ;   a  gg	! [         a     Nf = f)
NzOS/2versioni  usWeightClassr    r   r   r   )get_sfnt_tableget_ps_font_inforeplace_weight_regexesre	fullmatchI
ValueErrorsearchr   
StyleFlagsBOLDstyle_flags)os2ps_font_info_weightregexr   r   r   styless        rL   
get_weight#ttfFontProperty.<locals>.get_weight  s    !!&)3y>V+''	"%%'199#rBHb  
 "1<<BDDAA!M "1 EMM#r*E!099U24400!M "1 
 ""d&6&66  		s   ,D 
D#"D#c              3  ,   >#    U  H	  oT;   v   M     g 7fNrI   r   wordsfnt4s     rL   r   "ttfFontProperty.<locals>.<genexpr>  s     
E%DT5=%D   )narrowr   condr   	demi condr    c              3  ,   >#    U  H	  oT;   v   M     g 7fr   rI   r   s     rL   r   r     s     H'GtU]'Gr   wider"   r#   r"   z$Non-scalable fonts are not supportedscalable)family_nameget_sfntgetr   rT   findr   r   ITALICr   filter
style_nameintanyr  NotImplementedErrorr   r   )r   r   sfntmac_keyms_keysfnt2r   r   wws_subfamilytypographic_subfamilyfont_subfamilyr   r   r   r   r   r   s   `              @@rL   ttfFontPropertyr  T  s    D ==?DGF XXmmmS)00;AAC EXXlllC(//<BBD 
XXmmmS)00;AAC EXXlllC(//<BBD 
 zz)!	H		"	I	!	#				"	"d&6&6	6
 zz|11 MN*7*M*C077	B27212C8??	J+7+N+S188C)6)=)3/66{C1610137>>{K*6*>*C077DF %vdF#$9(9F2 F 
E%D
EEE		"	H'GH	H	H ==!"HIIDTZZgwMMrN   c           	       ^ UR                  5       nUR                  5       R                  5       mUR                  5       S:w  d  SUR                  5       ;   a  SnOSUR                  5       ;   a  SnOSnUR                  5       S;   a  SnOSnUR	                  5       R                  5       nU[
        ;  a  SnST;   a  SnO<[        U4S	 jS
 5       5      (       a  SnO[        U4S jS 5       5      (       a  SnOSnSn[        XX4XVU5      $ )a  
Extract information from an AFM font file.

Parameters
----------
fontpath : str
    The filename corresponding to *font*.
font : AFM
    The AFM font file from which information will be extracted.

Returns
-------
`FontEntry`
    The extracted font properties.
r   r   r   r!   r   r   r  r    c              3  ,   >#    U  H	  oT;   v   M     g 7fr   rI   r   r   fontnames     rL   r   "afmFontProperty.<locals>.<genexpr>  s     =*<$X*<r   )r  r  r   c              3  ,   >#    U  H	  oT;   v   M     g 7fr   rI   r  s     rL   r   r    s     K*J$X*Jr   r  r"   r  )get_familynameget_fontnamerT   	get_angler   weight_dictr  r   )	fontpathr   r   r   r   r   r   r   r  s	           @rL   afmFontPropertyr%    s    "  D  "((*H ~~1DJJL 8	djjl	"
 zz|11__$$&F[  h"	=*<=	=	=	K*JK	K	K DXUVdKKrN   c                F   ^  [         R                  " T 5      U 4S j5       nU$ )a  
A decorator to limit the call signature to single a positional argument
or alternatively only keyword arguments.

We still accept but deprecate all other call signatures.

When the deprecation expires we can switch the signature to::

    __init__(self, pattern=None, /, *, family=None, style=None, ...)

plus a runtime check that pattern is not used alongside with the
keyword arguments. This results eventually in the two possible
call signatures::

    FontProperties(pattern)
    FontProperties(family=..., size=..., ...)

c                "  > [        U5      S:  d  [        U5      S:X  a  U(       a  [        R                  " SSS9  [        U5      S:X  a:  U(       d3  [        R                  " US   5      (       d  [        R                  " SSS9  T" U /UQ70 UD6$ )Nrl   z3.10zPassing individual properties to FontProperties() positionally was deprecated in Matplotlib %(since)s and will be removed in %(removal)s. Please pass all properties via keyword arguments.)messager   zPassing family as positional argument to FontProperties() was deprecated in Matplotlib %(since)s and will be removed in %(removal)s. Please pass family names as keywordargument.)lenr	   warn_deprecatedr   is_scalar_or_string)r   argskwargsinit_methods      rL   wrapper-_cleanup_fontproperties_init.<locals>.wrapper,  s     t9q=CINv   1 t9>&1J1J4PQ71S1S  $ 41$1&11rN   )	functoolswraps)r.  r/  s   ` rL   _cleanup_fontproperties_initr3    s'    & __[!2 "28 NrN   c                      \ rS rSrSr\    SS j5       r\S 5       rS r	S r
S rS	 rS
 rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS r\r \r!\r"\r#Sr$g)FontPropertiesiL  a
  
A class for storing and manipulating font properties.

The font properties are the six properties described in the
`W3C Cascading Style Sheet, Level 1
<http://www.w3.org/TR/1998/REC-CSS2-19980512/>`_ font
specification and *math_fontfamily* for math fonts:

- family: A list of font names in decreasing order of priority.
  The items may include a generic font family name, either 'sans-serif',
  'serif', 'cursive', 'fantasy', or 'monospace'.  In that case, the actual
  font to be used will be looked up from the associated rcParam during the
  search process in `.findfont`. Default: :rc:`font.family`

- style: Either 'normal', 'italic' or 'oblique'.
  Default: :rc:`font.style`

- variant: Either 'normal' or 'small-caps'.
  Default: :rc:`font.variant`

- stretch: A numeric value in the range 0-1000 or one of
  'ultra-condensed', 'extra-condensed', 'condensed',
  'semi-condensed', 'normal', 'semi-expanded', 'expanded',
  'extra-expanded' or 'ultra-expanded'. Default: :rc:`font.stretch`

- weight: A numeric value in the range 0-1000 or one of
  'ultralight', 'light', 'normal', 'regular', 'book', 'medium',
  'roman', 'semibold', 'demibold', 'demi', 'bold', 'heavy',
  'extra bold', 'black'. Default: :rc:`font.weight`

- size: Either a relative value of 'xx-small', 'x-small',
  'small', 'medium', 'large', 'x-large', 'xx-large' or an
  absolute font size, e.g., 10. Default: :rc:`font.size`

- math_fontfamily: The family of fonts used to render math text.
  Supported values are: 'dejavusans', 'dejavuserif', 'cm',
  'stix', 'stixsans' and 'custom'. Default: :rc:`mathtext.fontset`

Alternatively, a font may be specified using the absolute path to a font
file, by using the *fname* kwarg.  However, in this case, it is typically
simpler to just pass the path (as a `pathlib.Path`, not a `str`) to the
*font* kwarg of the `.Text` object.

The preferred usage of font sizes is to use the relative values,
e.g.,  'large', instead of absolute font sizes, e.g., 12.  This
approach allows all text sizes to be made larger or smaller based
on the font manager's default font size.

This class accepts a single positional string as fontconfig_ pattern_,
or alternatively individual properties as keyword arguments::

    FontProperties(pattern)
    FontProperties(*, family=None, style=None, variant=None, ...)

This support does not depend on fontconfig; we are merely borrowing its
pattern syntax for use here.

.. _fontconfig: https://www.freedesktop.org/wiki/Software/fontconfig/
.. _pattern:
   https://www.freedesktop.org/software/fontconfig/fontconfig-user.html

Note that Matplotlib's internal font manager and fontconfig use a
different algorithm to lookup fonts, so the results of the same pattern
may be different in Matplotlib than in other applications that use
fontconfig.
Nc	                   U R                  U5        U R                  U5        U R                  U5        U R                  U5        U R	                  U5        U R                  U5        U R                  U5        U R                  U5        [        U[        5      (       a*  Uc&  Uc"  Uc  Uc  Uc  Uc  U R                  U5        g g g g g g g g r   )
set_family	set_styleset_variant
set_weightset_stretchset_fileset_sizeset_math_fontfamilyrt   ru   set_fontconfig_pattern)	r   familyr   r   r   r   r   r   math_fontfamilys	            rL   __init__FontProperties.__init__  s    
 	u!!ed  1 vs##Mgo&.O''/ :GO ;IoM $rN   c                    Uc  U " 5       $ [        X5      (       a  U$ [        U[        R                  5      (       a  U " US9$ [        U[        5      (       a  U " U5      $ U " S0 UD6$ )ah  
Generic constructor which can build a `.FontProperties` from any of the
following:

- a `.FontProperties`: it is passed through as is;
- `None`: a `.FontProperties` using rc values is used;
- an `os.PathLike`: it is used as path to the font file;
- a `str`: it is parsed as a fontconfig pattern;
- a `dict`: it is passed as ``**kwargs`` to `.FontProperties`.
)r   rI   )rt   rQ   PathLikeru   )clsargs     rL   	_from_anyFontProperties._from_any  s]     ;5L!!JR[[))S>!S!!s8O::rN   c           	        [        U R                  5       5      U R                  5       U R                  5       U R	                  5       U R                  5       U R                  5       U R                  5       U R                  5       4n[        U5      $ r   )
tuple
get_family	get_slantget_variantr   get_stretchget_sizeget_fileget_math_fontfamilyhash)r   ls     rL   __hash__FontProperties.__hash__  sm    4??$%^^__]]_]]_%%') AwrN   c                0    [        U 5      [        U5      :H  $ r   )rS  )r   others     rL   __eq__FontProperties.__eq__  s    DzT%[((rN   c                "    U R                  5       $ r   )get_fontconfig_patternr   s    rL   __str__FontProperties.__str__  s    **,,rN   c                    U R                   $ )z
Return a list of individual font family names or generic family names.

The font families or generic font families (which will be resolved
from their respective rcParams when searching for a matching font) in
the order of preference.
)_familyr]  s    rL   rL  FontProperties.get_family  s     ||rN   c                >    [        [        U 5      5      R                  $ )zD
Return the name of the font that best matches the font properties.
)get_fontfindfontr  r]  s    rL   get_nameFontProperties.get_name  s     '333rN   c                    U R                   $ )zF
Return the font style.  Values are: 'normal', 'italic' or 'oblique'.
)_slantr]  s    rL   	get_styleFontProperties.get_style  s     {{rN   c                    U R                   $ )zA
Return the font variant.  Values are: 'normal' or 'small-caps'.
)_variantr]  s    rL   rN  FontProperties.get_variant  s     }}rN   c                    U R                   $ )z
Set the font weight.  Options are: A numeric value in the
range 0-1000 or one of 'light', 'normal', 'regular', 'book',
'medium', 'roman', 'semibold', 'demibold', 'demi', 'bold',
'heavy', 'extra bold', 'black'
)_weightr]  s    rL   r   FontProperties.get_weight  s     ||rN   c                    U R                   $ )z
Return the font stretch or width.  Options are: 'ultra-condensed',
'extra-condensed', 'condensed', 'semi-condensed', 'normal',
'semi-expanded', 'expanded', 'extra-expanded', 'ultra-expanded'.
)_stretchr]  s    rL   rO  FontProperties.get_stretch  s     }}rN   c                    U R                   $ )z
Return the font size.
)_sizer]  s    rL   rP  FontProperties.get_size       zzrN   c                    U R                   $ )z-
Return the filename of the associated font.
)_filer]  s    rL   rQ  FontProperties.get_file   rx  rN   c                    [        U 5      $ )z
Get a fontconfig_ pattern_ suitable for looking up the font as
specified with fontconfig's ``fc-match`` utility.

This support does not depend on fontconfig; we are merely borrowing its
pattern syntax for use here.
)r   r]  s    rL   r\  %FontProperties.get_fontconfig_pattern  s     +400rN   c                l    Uc  [         R                  S   n[        U[        5      (       a  U/nXl        g)a&  
Change the font family.  Can be either an alias (generic name
is CSS parlance), such as: 'serif', 'sans-serif', 'cursive',
'fantasy', or 'monospace', a real font name or a list of real
font names.  Real font names are not supported when
:rc:`text.usetex` is `True`. Default: :rc:`font.family`
Nzfont.family)mplrcParamsrt   ru   ra  )r   r@  s     rL   r7  FontProperties.set_family  s0     >\\-0Ffc""XFrN   c                j    Uc  [         R                  S   n[        R                  " / SQUS9  Xl        g)zo
Set the font style.

Parameters
----------
style : {'normal', 'italic', 'oblique'}, default: :rc:`font.style`
Nz
font.style)r!   r   r   )r   )r  r  r	   check_in_listri  )r   r   s     rL   r8  FontProperties.set_style  s-     =LL.E:%HrN   c                j    Uc  [         R                  S   n[        R                  " SS/US9  Xl        g)zn
Set the font variant.

Parameters
----------
variant : {'normal', 'small-caps'}, default: :rc:`font.variant`
Nzfont.variantr!   r   )r   )r  r  r	   r  rm  )r   r   s     rL   r9  FontProperties.set_variant+  s1     ?ll>2GHl3WErN   c                    Uc  [         R                  S   nU[        ;   a  Xl        g [	        U5      nSUs=::  a  S::  a
  O  OXl        g [        SU< S35      e! [
         a     Nf = f)a  
Set the font weight.

Parameters
----------
weight : int or {'ultralight', 'light', 'normal', 'regular', 'book', 'medium', 'roman', 'semibold', 'demibold', 'demi', 'bold', 'heavy', 'extra bold', 'black'}, default: :rc:`font.weight`
    If int, must be in the range  0-1000.
Nzfont.weightr   r8   zweight= is invalid)r  r  r#  rp  r  r   r   r   s     rL   r:  FontProperties.set_weight8  s{     >\\-0F[ !L	[F F"d"% # GF9K011  		   A 
A)(A)c                    Uc  [         R                  S   nU[        ;   a  Xl        g [	        U5      nSUs=::  a  S::  a
  O  OXl        g [        SU< S35      e! [
         a     Nf = f)a   
Set the font stretch or width.

Parameters
----------
stretch : int or {'ultra-condensed', 'extra-condensed', 'condensed', 'semi-condensed', 'normal', 'semi-expanded', 'expanded', 'extra-expanded', 'ultra-expanded'}, default: :rc:`font.stretch`
    If int, must be in the range  0-1000.
Nzfont.stretchr   r8   zstretch=r  )r  r  stretch_dictrs  r  r   )r   r   s     rL   r;  FontProperties.set_stretchR  s{     ?ll>2Gl"#M	'lG G#t# ' $ HG:[122  		r  c                v   Uc  [         R                  S   n [        U5      nUS:  a  [        R                  SU5        SnXl        g! [         af     [        U   nU[
        R                  5       -  n NR! [         a5  n[        SSR                  [        [        [        5      5      -   5      UeSnAff = ff = f)a  
Set the font size.

Parameters
----------
size : float or {'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large'}, default: :rc:`font.size`
    If a float, the font size in points. The string values denote
    sizes relative to the default font size.
N	font.sizez%Size is invalid. Valid font size are , r   zHFontsize %1.2f < 1.0 pt not allowed by FreeType. Setting fontsize = 1 pt)r  r  floatr   font_scalingsFontManagerget_default_sizeKeyErrorrV   r   ru   r   inforv  )r   r   scaleerrs       rL   r=  FontProperties.set_sizel  s     <<<,D
	>;D #:II 0157D
  	>>%d+ {;;==  C ;iiC 789:?BCC	>s/   A 
B8	A5B85
B4?0B//B44B8c                P    Ub  [         R                  " U5      U l        gSU l        g)z_
Set the filename of the fontfile to use.  In this case, all
other properties will be ignored.
N)rQ   fspathrz  )r   files     rL   r<  FontProperties.set_file  s    
 )-(8RYYt_
d
rN   c                    [        U5      R                  5        HF  u  p#[        U5      [        L a  [	        U SU-   5      " US   5        M1  [	        U SU-   5      " U5        MH     g)z
Set the properties by parsing a fontconfig_ *pattern*.

This support does not depend on fontconfig; we are merely borrowing its
pattern syntax for use here.
set_r   N)r   rz   typelistgetattr)r   patternr   vals       rL   r?  %FontProperties.set_fontconfig_pattern  sU     19??AHCCyD fsl+CF3fsl+C0	 BrN   c                    U R                   $ )ze
Return the name of the font family used for math text.

The default font is :rc:`mathtext.fontset`.
)_math_fontfamilyr]  s    rL   rR  "FontProperties.get_math_fontfamily  s     $$$rN   c                    Uc  [         R                  S   nO5[        S   R                  R	                  5       n[
        R                  " X!S9  Xl        g)a`  
Set the font family for text in math mode.

If not set explicitly, :rc:`mathtext.fontset` will be used.

Parameters
----------
fontfamily : str
    The name of the font family.

    Available font families are defined in the
    :ref:`default matplotlibrc file <customizing-with-matplotlibrc-files>`.

See Also
--------
.text.Text.get_math_fontfamily
Nzmathtext.fontset)rA  )r  r  r   validvaluesr	   r  r  )r   
fontfamilyvalid_fontss      rL   r>  "FontProperties.set_math_fontfamily  sI    $ &89J%&89??FFHK {G *rN   c                .    [         R                   " U 5      $ )zReturn a copy of self.)copyr]  s    rL   r  FontProperties.copy  s    yyrN   )ra  rz  r  rv  ri  rs  rm  rp  )NNNNNNNN)%r   r   r   r   r   r3  rB  classmethodrH  rU  rY  r^  rL  rf  rj  rN  r   rO  rP  rQ  r\  r7  r8  r9  r:  r;  r=  r<  r?  rR  r>  r  set_namerM  	set_slantget_size_in_pointsr   rI   rN   rL   r5  r5  L  s    AF "EI$(!%0 "0(  ,	)-41 2434<C1%+6
 HII!rN   r5  c                  (   ^  \ rS rSrU 4S jrSrU =r$ )_JSONEncoderi  c                f  > [        U[        5      (       a  [        UR                  SS9$ [        U[        5      (       aS  [        UR                  SS9n [        [        US   5      R                  [        R                  " 5       5      5      US'   U$ [        TU ]1  U5      $ ! [         a     U$ f = f)Nr  	__class__r   r   )rt   r  dict__dict__r   ru   r   relative_tor  get_data_pathr   superdefault)r   or   r  s      rL   r  _JSONEncoder.default  s    a%%

m<<9%%QZZ;7A !aj!1!=!=c>O>O>Q!RS'
 H7?1%%	  Hs   <B" "
B0/B0rI   )r   r   r   r   r  r   __classcell__r  s   @rL   r  r    s    & &rN   r  c                   U R                  SS 5      nUc  U $ US:X  a6  [        R                  [        5      nUR                  R	                  U 5        U$ US:X  am  [
        R                  R                  U S   5      (       d9  [
        R                  R                  [        R                  " 5       U S   5      U S'   [        S0 U D6nU$ [        SU-  5      e)Nr  r  r   r   z*Don't know how to deserialize __class__=%srI   )popr  __new__r  r   rQ   rU   isabsrV   r  r  r   r   )r  rF  rs      rL   _json_decoder    s    
%%T
"C
{		,	

!		ww}}QwZ((c&7&7&91W:FAgJNNEKLLrN   c           	     @    [         R                  " U5         [        US5       n[        R                  " X[
        SS9  SSS5        SSS5        g! , (       d  f       N= f! , (       d  f       g= f! [         a   n[        R                  SU5         SnAgSnAff = f)a  
Dump `FontManager` *data* as JSON to the file named *filename*.

See Also
--------
json_load

Notes
-----
File paths that are children of the Matplotlib data path (typically, fonts
shipped with Matplotlib) are stored relative to that data path (to remain
valid across virtualenvs).

This function temporarily locks the output file to prevent multiple
processes from overwriting one another's output.
wr   )rF  indentNz$Could not save font_manager cache %s)	r   
_lock_pathopenjsondumpr  rg   r   r   )datar]   fhes       rL   	json_dumpr    sm    "@h'h)<IIdL; *='')<)<'' @;Q??@sK   A3 A"A A"A3 
A	A""
A0,A3 0A3 3
B=BBc                    [        U 5       n[        R                  " U[        S9sSSS5        $ ! , (       d  f       g= f)zX
Load a `FontManager` from the JSON file named *filename*.

See Also
--------
json_dump
)object_hookN)r  r  loadr  )r]   r  s     rL   	json_loadr    s%     
h2yy6 
s   /
=c                      \ rS rSrSrSrSS jrS r\S 5       r	S r
\S	 5       rS
 r\S 5       rS rS rS rS rS rS r  SS jrS r  SS jr\" S5      S 5       rSrg)r  i  a  
On import, the `FontManager` singleton instance creates a list of ttf and
afm fonts and caches their `FontProperties`.  The `FontManager.findfont`
method does a nearest neighbor search to find the font that most closely
matches the specification.  If no good enough match is found, the default
font is returned.

Fonts added with the `FontManager.addfont` method will not persist in the
cache; therefore, `addfont` will need to be called every time Matplotlib is
imported. This method should only be used if and when a font cannot be
installed on your operating system by other means.

Notes
-----
The `FontManager.addfont` method must be called on the global `FontManager`
instance.

Example usage::

    import matplotlib.pyplot as plt
    from matplotlib import font_manager

    font_dirs = ["/resources/fonts"]  # The path to the custom font file.
    font_files = font_manager.findSystemFonts(fontpaths=font_dirs)

    for font_file in font_files:
        font_manager.fontManager.addfont(font_file)
i  Nc                   U R                   U l        X l        Xl        S Vs/ s H  n[        R
                  " SU5      PM     nn[        R                  SU5        SSS.U l        / U l	        / U l
        [        R                  " SS 5      nUR                  5          S	 H0  n/ [        XFS
9Q[        US
9Q H  n U R                  U5        M     M2     UR'                  5         g s  snf ! [          a!  n[        R#                  SXx5         S nAMY  S nAf[$         a!  n[        R#                  SXx5         S nAM  S nAff = f! UR'                  5         f = f)N)rH   rE   pdfcorefontsrC   zfont search path %szDejaVu Sans	Helvetica)rH   rE      c                 ,    [         R                  S5      $ )Nz>Matplotlib is building the font cache; this may take a moment.)r   r   rI   rN   rL   <lambda>&FontManager.__init__.<locals>.<lambda>G  s    4<<L,NrN   )rE   rH   rJ   zFailed to open font file %s: %sz-Failed to extract font properties from %s: %s)__version___version_FontManager__default_weightdefault_sizer   _get_data_pathr   debugdefaultFamilyafmlistttflist	threadingTimerstartr   addfontrg   r  	Exceptioncancel)	r   r   r   subdirpathstimerrK   rU   excs	            rL   rB  FontManager.__init__4  sI   (( &   >?=V %%gv6= 	 ?

(%0 !    $N O	)@oeE @-g>@D3T*@ * LLN7?* # P		"CTOO$ 3		 #'(,3 33 LLNsM   !C#D? 9C(
D? (
D<2DD? D<D71D? 7D<<D? ?Ec                   [         R                  " U5      n[        U5      R                  R	                  5       S:X  aS  [        US5       n[        R                  " U5      nSSS5        [        UW5      nU R                  R                  U5        O<[        R                  " U5      n[        U5      nU R                  R                  U5        U R                  R!                  5         g! , (       d  f       N= f)az  
Cache the properties of the font at *path* to make it available to the
`FontManager`.  The type of font is inferred from the path suffix.

Parameters
----------
path : str or path-like

Notes
-----
This method is useful for adding a custom font without installing it in
your operating system. See the `FontManager` singleton instance for
usage and caveats about this function.
z.afmrbN)rQ   r   r   rS   rT   r  r
   AFMr%  r  appendr   FT2Fontr  r  _findfont_cachedcache_clear)r   rU   r  r   props        rL   r  FontManager.addfontX  s    " {{4 :""$.dD!Rxx| ""4.DLL%??4(D"4(DLL%))+ "!s   
C((
C6c           
         U R                   R                  5        VVs0 s H  u  pXR                  X!S9_M     snn$ s  snnf )NrJ   )r  rz   re  )r   rY   r@  s      rL   defaultFontFontManager.defaultFontu  sH    
 $(#5#5#;#;#=?#=KC ]]6]77#=? 	? ?s   =c                    U R                   $ )z!
Return the default font weight.
r  r]  s    rL   get_default_weightFontManager.get_default_weight|  s     $$$rN   c                 (    [         R                  S   $ )z
Return the default font size.
r  r  r  rI   rN   rL   r  FontManager.get_default_size  s    
 ||K((rN   c                    Xl         g)z>
Set the default font weight.  The initial value is 'normal'.
Nr  r  s     rL   set_default_weightFontManager.set_default_weight  s
     !'rN   c                >    U S;   a  Sn [         R                  SU -      $ )N)r;   r@   rA   zfont.r  )r@  s    rL   _expand_aliasesFontManager._expand_aliases  s$    ++!F||Gf,--rN   c                   [        U[        [        45      (       d  U/nO[        U5      S:X  a  gUR	                  5       nS[        U5      -  n[        U5       H  u  pEUR	                  5       nU[        ;   aX  / [        [        R                  U R                  U5      5      QnX&;   a&  UR                  U5      nXG[        U5      -  -   U-  s  $ Mw  XR:X  d  M~  XC-  s  $    g)z
Return a match score between the list of font families in
*families* and the font family name *family2*.

An exact match at the head of the list returns 0.0.

A match further down the list will return between 0 and 1.

No match will return 1.0.
r   r   rl   )rt   r  rK  r)  rT   	enumeratefont_family_aliasesr   ru   r  index)r   familiesfamily2stepifamily1optionsidxs           rL   score_familyFontManager.score_family  s     (T5M22 zH]a--/3x= #H-JAmmoG--JC		4+?+?+HIJ%!--0Cs7|!34<< & # x . rN   c                *    X:X  a  gUS;   a  US;   a  gg)z
Return a match score between *style1* and *style2*.

An exact match returns 0.0.

A match between 'italic' and 'oblique' returns 0.1.

No match returns 1.0.
        )r   r   g?r   rI   )r   style1style2s      rL   score_styleFontManager.score_style  s%     --11rN   c                    X:X  a  gg)ze
Return a match score between *variant1* and *variant2*.

An exact match returns 0.0, otherwise 1.0.
r  r   rI   )r   variant1variant2s      rL   score_variantFontManager.score_variant  s     rN   c                     [        U5      n [        U5      n[	        X4-
  5      S-  $ ! [         a    [        R                  US5      n N>f = f! [         a    [        R                  US5      n NXf = f)z
Return a match score between *stretch1* and *stretch2*.

The result is the absolute value of the difference between the
CSS numeric values of *stretch1* and *stretch2*, normalized
between 0.0 and 1.0.
r   g     @@)r  r   r  r
  abs)r   stretch1stretch2stretchval1stretchval2s        rL   score_stretchFontManager.score_stretch  sx    	:h-K	:h-K ;,-66  	:&**8S9K	:  	:&**8S9K	:s    ) A  AA A21A2c                    [         R                  " X5      (       a  g[        U[        5      (       a  UO[        U   n[        U[        5      (       a  UO[        U   nS[        X4-
  5      S-  -  S-   $ )a0  
Return a match score between *weight1* and *weight2*.

The result is 0.0 if both weight1 and weight 2 are given as strings
and have the same value.

Otherwise, the result is the absolute value of the difference between
the CSS numeric values of *weight1* and *weight2*, normalized between
0.05 and 1.0.
r  gffffff?r8   g?)r   
_str_equalrt   r   r#  r(  )r   weight1weight2w1w2s        rL   score_weightFontManager.score_weight  sc     G--"7F33WW9M"7F33WW9Ms27|d*+d22rN   c                    US:X  a  g [        U5      n [        U5      n[	        X4-
  5      S-  $ ! [         a    U R                  [        U   -  n N>f = f! [         a     gf = f)ae  
Return a match score between *size1* and *size2*.

If *size2* (the size specified in the font file) is 'scalable', this
function always returns 0.0, since any font size can be generated.

Otherwise, the result is the absolute distance between *size1* and
*size2*, normalized so that the usual range of font sizes (6pt -
72pt) will lie between 0.0 and 1.0.
r  r  r   H   )r  r   r  r  r(  )r   size1size2sizeval1sizeval2s        rL   
score_sizeFontManager.score_size  s|     J	@U|H	U|H 8&'",,  	@((=+??H	@  		s    0 A  AA
A#"A#c                    [        S S 5       5      nU R                  XX4UU5      n[        U[        R                  5      (       a  UR                  5       eU$ )a[  
Find the path to the font file most closely matching the given font properties.

Parameters
----------
prop : str or `~matplotlib.font_manager.FontProperties`
    The font properties to search for. This can be either a
    `.FontProperties` object or a string defining a
    `fontconfig patterns`_.

fontext : {'ttf', 'afm'}, default: 'ttf'
    The extension of the font file:

    - 'ttf': TrueType and OpenType fonts (.ttf, .ttc, .otf)
    - 'afm': Adobe Font Metrics (.afm)

directory : str, optional
    If given, only search this directory and its subdirectories.

fallback_to_default : bool
    If True, will fall back to the default font family (usually
    "DejaVu Sans" or "Helvetica") if the first lookup hard-fails.

rebuild_if_missing : bool
    Whether to rebuild the font cache and search again if the first
    match appears to point to a nonexisting font (i.e., the font cache
    contains outdated entries).

Returns
-------
str
    The filename of the best matching font.

Notes
-----
This performs a nearest neighbor search.  Each font is given a
similarity score to the target font properties.  The first font with
the highest score is returned.  If no matches below a certain
threshold are found, the default font (usually DejaVu Sans) is
returned.

The result is cached, so subsequent lookups don't have to
perform the O(n) nearest neighbor search.

See the `W3C Cascading Style Sheet, Level 1
<http://www.w3.org/TR/1998/REC-CSS2-19980512/>`_ documentation
for a description of the font finding algorithm.

.. _fontconfig patterns:
   https://www.freedesktop.org/software/fontconfig/fontconfig-user.html
c              3  Z   #    U  H!  n[        [        R                  U   5      v   M#     g 7fr   )rK  r  r  )r   r   s     rL   r   'FontManager.findfont.<locals>.<genexpr>E  s)       ?s%S 122 ?s   )+)z
font.serifzfont.sans-serifzfont.cursivezfont.fantasyzfont.monospace)rK  r  rt   r   _ExceptionInfoto_exception)r   r  rK   rW   fallback_to_defaultrebuild_if_missing	rc_paramsrets           rL   re  FontManager.findfont  sd    p   ?  	 ##9;M c5//00""$$
rN   c                j    [        U R                   Vs1 s H  oR                  iM     sn5      $ s  snf )z#Return the list of available fonts.)r  r  r   )r   r   s     rL   get_font_namesFontManager.get_font_namesO  s%    4<<8<4YY<8998s   0c                   [         R                  U5      n/ nUR                  5        HF  nUR                  5       nUR	                  U5         UR                  U R                  XUSUS95        MH     U(       de  U(       aS  U R                  U   n	UR                  5       nUR	                  U	5        UR                  U R                  XUSUS95        U$ [        S5      eU$ ! [         a^    U[        ;   a9  [        R                  SUSR                  U R                  U5      5      5         GM  [        R                  SU5         GM  f = f)ai  
Find the paths to the font files most closely matching the given properties.

Parameters
----------
prop : str or `~matplotlib.font_manager.FontProperties`
    The font properties to search for. This can be either a
    `.FontProperties` object or a string defining a
    `fontconfig patterns`_.

fontext : {'ttf', 'afm'}, default: 'ttf'
    The extension of the font file:

    - 'ttf': TrueType and OpenType fonts (.ttf, .ttc, .otf)
    - 'afm': Adobe Font Metrics (.afm)

directory : str, optional
    If given, only search this directory and its subdirectories.

fallback_to_default : bool
    If True, will fall back to the default font family (usually
    "DejaVu Sans" or "Helvetica") if none of the families were found.

rebuild_if_missing : bool
    Whether to rebuild the font cache and search again if the first
    match appears to point to a nonexisting font (i.e., the font cache
    contains outdated entries).

Returns
-------
list[str]
    The paths of the fonts found.

Notes
-----
This is an extension/wrapper of the original findfont API, which only
returns a single font for given font properties. Instead, this API
returns a list of filepaths of multiple fonts which closely match the
given font properties.  Since this internally uses the original API,
there's no change to the logic of performing the nearest neighbor
search.  See `findfont` for more details.
F)rD  rE  [findfont: Generic family %r not found because none of the following families were found: %sr  z#findfont: Font family %r not found.TzFFailed to find any font, and fallback to the default font was disabled)r5  rH  rL  r  r7  r  re  r   r  r   r   rV   r  r  )
r   r  rK   rW   rD  rE  fpathsr@  cpropdfamilys
             rL   _find_fonts_by_props FontManager._find_fonts_by_propsS  sP   Z ''-oo'FIIKEV$PMM	,1+= "  (0 ",,W5		  )MM	,0+= "   ! "D E E 9  P00LLH		$*>*>v*F G  LL!FOOPs   !C  A	E-EEi   c           
     n   [         R                  U5      nUR                  5       nUb  U$ US:X  a  U R                  nOU R                  nSn	S n
[
        R                  SU5        U GH`  nUb.  [        U5      [        UR                  5      R                  ;  a  M5  U R                  UR                  5       UR                  5      S-  U R                  UR                  5       UR                  5      -   U R!                  UR#                  5       UR$                  5      -   U R'                  UR)                  5       UR*                  5      -   U R-                  UR/                  5       UR0                  5      -   U R3                  UR5                  5       UR6                  5      -   n[
        R                  SX5        X:  a  Un	Un
US:X  d  GMa    O   U
b  U	S:  Ga  U(       a  [
        R9                  SUR                  5       U R:                  U   5        [=        [>        R@                  UR                  5       5       HD  nU[B        ;   d  M  [
        R9                  S	US
RE                  U RG                  U5      5      5        MF     URI                  5       nURK                  U R:                  U   5        U RM                  XUSS9$ [N        RP                  " [R        SU S35      $ [
        R                  SXR                  U
R                  U	5        U
R                  n[T        RV                  RY                  U5      (       dt  U(       aR  [
        R[                  S5        []        SS9n[_        U 5      Ra                  [_        U5      5        U RM                  XUSS9$ [N        RP                  " [R        S5      $ [c        U5      $ )NrE   g?O8Mzfindfont: Matching %s.
   zfindfont: score(%s) = %sr   g      $@z7findfont: Font family %s not found. Falling back to %s.rM  r  F)rD  zFailed to find font z/, and fallback to the default font was disabledz2findfont: Matching %s to %s (%r) with score of %f.z7findfont: Found a missing font file.  Rebuilding cache.try_read_cache)rE  zNo valid font could be found)2r5  rH  rQ  r  r  r   r  r   r   parentsr  rL  r   r   rj  r   r%  rN  r   r5  r   r   r-  rO  r   r=  rP  r   r   r  r   ru   rT   r  rV   r  r  r7  re  r   rB  r   rQ   rU   isfiler  _load_fontmanagervarsr   _cached_realpath)r   r  rK   rW   rD  rE  rF  r   fontlist
best_score	best_fontr   scorer@  default_propresultnew_fms                    rL   r  FontManager._findfont_cached  s1    ''-Le||H||H
	

+T2D%O4

+;+C+CC&&t'8$))DrI''(8$**EF))$*:*:*<dllKL (():DKKHI ))$*:*:*<dllK	L
 t}}		BCE JJ14?!"
 	z! $ 
d 2"MOO%t'9'9''BD "#))T__->?F!44L"DIId.B.B6.J$KM @  $yy{''(:(:7(CD}}\I9> % @ @ ++*4& 1    JJK^^Y__jJ__Fww~~f%%!		MO*%@
 T
!!$v,/}}9 % H H ++J8VWW''rN   )__default_weightr  r  r  r  r  )Nr!   )rH   NTT)r   r   r   r   r   r  rB  r  propertyr   r  staticmethodr  r
  r  r  r   r%  r-  r5  r=  re  rJ  rQ  r   r  r   rI   rN   rL   r  r    s    > K"H,: ? ?% ) )' . .<"	7$3$-0 7;>B@D: CGJNXt t_S( S(rN   r  c                    [         R                  R                  U 5      S   R                  5       S:X  a*  [	        U S5       nUR                  S5      S:H  sSSS5        $ g! , (       d  f       g= f)z
Return whether the given font is a Postscript Compact Font Format Font
embedded in an OpenType wrapper.  Used by the PostScript and PDF backends
that cannot subset these fonts.
rl   z.otfr  r   s   OTTONF)rQ   rU   splitextrT   r  read)r]   fds     rL   is_opentype_cff_fontrk    s[     
ww!!$**,6(D!R771:( "!  "!s   A  
A.@   c                   U tpE[         R                  " XAU Vs/ s H  n[         R                  " XaUS9PM     snUS9$ s  snf )N)_kerning_factor)_fallback_listrn  )r   r  )font_filepathshinting_factorrn  	thread_idfirst_fontpathrestfpaths          rL   	_get_fontrv    sX    *N?? 

 	 OO / 
 (
 

s   >register_at_fork)after_in_childc                @    [         R                  R                  U 5      $ r   )rQ   rU   realpath)rU   s    rL   r[  r[  +  s     77D!!rN   c                   [        U [        [        [        45      (       a  [	        U 5      4nO[        S U  5       5      nUc  [        R                  S   n[        UU[        R                  S   [        R                  " 5       S9$ )a  
Get an `.ft2font.FT2Font` object given a list of file paths.

Parameters
----------
font_filepaths : Iterable[str, Path, bytes], str, Path, bytes
    Relative or absolute paths to the font files to be used.

    If a single string, bytes, or `pathlib.Path`, then it will be treated
    as a list with that entry only.

    If more than one filepath is passed, then the returned FT2Font object
    will fall back through the fonts, in the order given, to find a needed
    glyph.

Returns
-------
`.ft2font.FT2Font`

c              3  8   #    U  H  n[        U5      v   M     g 7fr   )r[  )r   r   s     rL   r   get_font.<locals>.<genexpr>J  s     J>%&u-->s   ztext.hinting_factorztext.kerning_factor)rn  rr  )rt   ru   r   r   r[  rK  r  r  rv  r  	get_ident)rp  rq  r  s      rL   rd  rd  2  sv    * .3e"455!.13J>JJ&;<%:;%%' rN   rU  c                   [        [        R                  " 5       S[        R                   S35      nU (       aL   [        U5      n[        US[        5       5      [        R                  :X  a  [        R                  SU5        U$  [        5       n[        X!5        [        R                  S5        U$ ! [         a     N8f = f)Nz
fontlist-vz.jsonr  z"Using fontManager instance from %szgenerated new fontManager)r   r  get_cachedirr  r  r  r  objectr   r  r  r  r  )rV  fm_pathfms      rL   rY  rY  Y  s    j)@)@(AGIG	7#B r:vx0K4K4KK

?I	 L 
BbII)*I  		s   B1 1
B>=B>)NrH   r   )Tr   
__future__r   base64r   r  dataclassesr1  r   ior   r  loggingnumbersr   rQ   pathlibr   r   r   r   r   r  
matplotlibr  r	   r
   r   r   matplotlib._fontconfig_patternr   r   matplotlib.rcsetupr   	getLoggerr   r   r  r  r#  r   r  home_HOMEr  devnullre   rp   ru   ro   rh   r
  r   r   rM   r^   rj   r   r   r   r   	dataclassr   r  r%  r3  r5  JSONEncoderr  r  r  r  r  rk  rv  hasattrrw  r  r[  rd  rY  fontManagerre  rJ  rI   rN   rL   <module>r     s6  6 #          	   	  
   1 1; *"     6 IIKE H 
 :68  77899:  $/bjjnn_-G1G	H
	      

<;"@ 
D 
D : :CD d#" " $"<|N~CLL0f}" }"@&4## &"M"@0	7o( o(d 
 
 2 ( 2!""y'<'<= 2" "$N )- $  !++G/  Es   :H. .I
	I
