+
    ,i87                        ^ RI HtHt ^ RIt^ RIt^ RIt^ RIHt ^ RIH	t	 ^ RI
t
^ RIt^ RIt^ RIt^ RIt^ RIt^ RIHtHtHtHtHtHtHtHtHtHtHtHt ^ RIHtH t H!t"H#t#H$t% ^ RI&H't'H(t( ]
PR                  ! R4      RJt*R	 t+R
 t,R t-R t.]P^                  Pa                  ]Pb                  R8H  ;'       g    ]*'       * RR7      R 4       t2]P^                  Pg                  R. R+O4      R 4       t4R t5R t6R t7R t8]P^                  Pa                  ]Pb                  R8g  ;'       g    ]*'       * RR7      R 4       t9R t:]P^                  Pa                  ]Pb                  R8g  RR7      R 4       t;R t<]P^                  Pa                  ]=! ]R4      '       * RR7      R  4       t>R! t?R" t@R# tAR$ tBR% tCR& tD]P^                  Pa                  ]Pb                  R8H  R'R7      R( 4       tER) tFR* tGR# ),    )BytesIOStringION)Path)Image)findfontfindSystemFonts	FontEntryFontPropertiesfontManager	json_dump	json_loadget_fontis_opentype_cff_fontMSUserFontDirectories_get_fontconfig_fontsttfFontProperty)cbookft2fontpyplot
rc_contextfigure)subprocess_run_helpersubprocess_run_for_testingzfc-listc                  L   \        R RR./R7      ;_uu_ 4        \        \        R.R7      4      p RRR4       \        X 4      P                  R8X  g   Q h\        V 4      pVP                  4       p\        V4      ^8X  g   Q hVR,          ^8X  g   Q hR#   + '       g   i     Lk; i)	font.sans-serifcmmi10Bitstream Vera Sans)rc
sans-seriffamilyNz
cmmi10.ttfi"  )r   r   r
   r   namer   get_charmaplen)fontfilefontcmaps      D/usr/lib/python3/dist-packages/matplotlib/tests/test_font_manager.pytest_font_priorityr)      s    	,-/ 
0 
0 N<.AB
0 >,... HDDt9:
0 
0s   BB#	c                     ^ \         P                  ! RR4      8X  g   Q h^ \         P                  ! RR4      8X  g   Q h^ \         P                  ! RR4      u;8  d   \         P                  ! RR4      8  g   Q h Q h^ \         P                  ! RR4      u;8  d   \         P                  ! RR4      8  g   Q h Q h\         P                  ! RR4      \         P                  ! RR4      8X  g   Q hR# )r   regularboldi  normalN)r   score_weight     r(   test_score_weightr1   (   s    ((I>>>>((8888((c2 7$$Xv67 8 7 8 7((9= 7$$Xv67 8 7 8 7$$Xy9$$S#./ 0 /r0   c           	         \        \        V R ,          4       \        V R ,          4      p\        P                  ! 4       ;_uu_ 4        \        P
                  ! RR4       RR/RRRR/RR/3 F>  p\        R/ VB p\        P                  ! VR	R
7      VP                  VR	R
7      8X  d   K>  Q h	  RRR4       R#   + '       g   i     R# ; i)zfontlist.jsonignorez findfont: Font family.*not foundr!   STIXGeneralr   weighti  zno such font familyF)rebuild_if_missingNr/   )r   r   r   warningscatch_warningsfilterwarningsr
   r   )tmp_pathcopypropfps   &   r(   test_json_serializationr>   3   s     k8o56X/0D		 	 	"	"*LM. 5xE 568D  '$'B((FMM"M?@ A @	8 
#	"	"	"s   AB8*B88C		c                     R p \        V 4      P                  4       '       d   \        V 4      '       g   Q h\        P                   Fm  pRVP
                  9   g   K  \        VP
                  R4      ;_uu_ 4       pVP                  ^4      R8H  pRRR4       X\        VP
                  4      8X  d   Km  Q h	  R#   + '       g   i     L2; i)z//usr/share/fonts/opentype/freefont/FreeMono.otfotfrbs   OTTON)r   existsr   r   ttflistfnameopenread)rD   ffdress       r(   test_otfrJ   B   s    =EE{#E****  AGGaggt$$ggajG+ %.qww7777	 !$$s   9B88Cwin32zno fontconfig installed)reasonc                  :    \        \        4       4      ^8  g   Q hR# )   N)r$   r   r/   r0   r(   test_get_fontconfig_fontsrO   M   s     $&'!+++r0   factorc                    \        \        R .R7      4      p\        V^R7      pVP                  4        VP	                  ^^d4       VP                  R4       VP                  4       p\        WR7      pVP                  4        VP	                  ^^d4       VP                  R4       \        P                  P                  VP                  4       VRR7       R# )r   r    )hinting_factorabcg?)rtolN)
r   r
   r   clearset_sizeset_textget_width_heightnptestingassert_allclose)rP   r&   font1expectedhinted_fonts   &    r(   test_hinting_factorr_   S   s    N<.9:DT!,E	KKM	NN2s	NN5%%'H47KS!JJ{;;=x$'  )r0   c                       \        R  \        P                   4       4      p V P                  R8X  g   Q hR#   \         d    \
        P                  ! R4        R# i ; i)c              3   r   "   T F-  p\        VP                  4      P                  R 8X  g   K)  Vx  K/  	  R# 5i)zseguisbi.ttfN)r   rD   r"   ).0entrys   & r(   	<genexpr>#test_utf16m_sfnt.<locals>.<genexpr>i   s1      B(;uU[[)...@ U(;s   &7
7iX  z0Couldn't find seguisbi.ttf font to test against.N)nextr   rC   r5   StopIterationpytestskip)rc   s    r(   test_utf16m_sfntrj   f   sZ    	# B(;(; B B ||s"""  HFGHs    7 !AAc                  2   \        R .R7      p \        \        V 4      4      P                  R8w  d   \        P
                  ! R4       \        P                  ! 4       w  rVP                  RRRV R7       R	 F  pVP                  \        4       VR7       K   	  R# )
zWenQuanYi Zen Heir    zwqy-zenhei.ttcz"Font wqy-zenhei.ttc may be missing      ?u   ⿓fontpropertiesformatNrawsvgpdfpsr
   r   r   r"   rh   ri   pltsubplotstextsavefigr   )r=   figaxfmts       r(   test_find_ttcr~   s   ss    	 34	5BHRL"2289llnGCGGB/GC*GIc* +r0   c                  @   \        R R.R7      p \        \        V 4      4      P                  pVR
9  d   \        P
                  ! RV R24       \        P                  ! 4       w  r#VP                  RRRV R7       R F  pVP                  \        4       VR7       K   	  R	# )zNoto Sans CJK SCzNoto Sans CJK JPr    z,Noto Sans CJK SC font may be missing (found )rl   u   Hello, 你好rm   ro   N)zNotoSansCJKsc-Regular.otfzNotoSansCJK-Regular.ttcrq   rv   )r=   r"   r{   r|   r}   s        r(   test_find_notor   }   s    	 24FG	HB""DKKB4&JKllnGCGGCobG9*GIc* +r0   c                    \         P                  ! \        4      ;_uu_ 4        \        V R ,          4       RRR4       \         P                  ! \        4      ;_uu_ 4        \        \	        V R ,          4      4       RRR4       \         P                  ! \        4      ;_uu_ 4        \        \        V R ,          4      4       RRR4       ^ RIHp \         P                  ! \        RR7      ;_uu_ 4        V! \        4       4       RRR4       R#   + '       g   i     L; i  + '       g   i     L; i  + '       g   i     L{; i  + '       g   i     R# ; i)znon-existent-font-name.ttfN)FT2Fontzfont file or a binary-mode file)match)
rh   raisesFileNotFoundErrorr   strbytesmatplotlib.ft2fontr   	TypeErrorr   )r:   r   s   & r(   test_find_invalidr      s    	(	)	)889 
* 
(	)	)X <<=> 
* 
(	)	)x">>?@ 
* +	y(I	J	J
 
K	J 
*	) 
*	) 
*	)
 
K	J	Js/   D D"&D54ED	"D2	5E	E	linuxz$only Linux with fontconfig installedc                 ,  a R o\        4       p\        ;QJ d    V3R lV 4       F  '       g   K   RM	  RM! V3R lV 4       4      '       d   \        P                  ! S R24       V P	                  R4      pVP                  RR7       \        P                  ! \        \        4      P                  S,          VP	                  S4      4       VP                  4       ;_uu_ 4       pVP                  R\        V 4      4       \        P                  ! 4        \        4       p\        ;QJ d    V3R lV 4       F  '       g   K   RM	  RM! V3R lV 4       4      '       g   Q h R	R	R	4       \        P                  ! 4        R	#   + '       g   i     L'; i)
mpltest.ttfc              3   .   <"   T F
  pSV9   x  K  	  R # 5iNr/   rb   r&   font_test_files   & r(   rd   (test_user_fonts_linux.<locals>.<genexpr>        
4ed>T!e   TF already exists in system fontsfonts)dirXDG_DATA_HOMEc              3   .   <"   T F
  pSV9   x  K  	  R # 5ir   r/   r   s   & r(   rd   r      s     <ed>T)er   N)r   anyrh   ri   joinensureshutilcopyfiler   __file__parentcontextsetenvr   r   cache_clear)tmpdirmonkeypatchr   user_fonts_dirmr   s   &&   @r(   test_user_fonts_linuxr      s    #N E
s
4e
4sss
4e
444~&&EFG [[)Nd#
OODN))N:"''79 
				!	#f+.))+!s<e<sss<e<<<<< 
 %%' 
	s   &AFF!FF	c                   a Ro\        \        4      P                  S,          p  \        P                  ! V 4       V3R l\        P
                   4       w  p\        P
                  P                  V4       \        P
                   Uu. uF(  pVP                  P                  S4      '       g   K&  VNK*  	  ppV F"  p\        P
                  P                  V4       K$  	  R# u upi   \        P
                   Uu. uF(  pTP                  P                  S4      '       g   K&  TNK*  	  Mu upi ppT F"  p\        P
                  P                  T4       K$  	  i ; i)z/Smoke test that addfont() accepts pathlib.Path.r   c              3   n   <"   T F*  pVP                   P                  S4      '       g   K&  Vx  K,  	  R # 5ir   )rD   endswithr   s   & r(   rd   'test_addfont_as_path.<locals>.<genexpr>   s,      :#64ZZ((8 $#6s   #5
5N)	r   r   r   r   addfontrC   removerD   r   )pathaddedr&   	to_remover   s       @r(   test_addfont_as_pathr      s   "N>  >1D	-D!:;#6#6 :""5)&1&9&9 =&9d

++N; T&9	 =D&&t, =k&9&9 =&9d

++N; T&9 =	 =D&&t, s*   AC' #C"0C"'E:#D)"D)(1EzWindows onlyc                    a \         P                  P                  R 4      '       g<   \         P                  P                  R4      '       g   \        P                  ! R4       \        P                  ! R4       Ro\        4       p \        ;QJ d    V3R lV  4       F  '       g   K   RM	  RM! V3R lV  4       4      '       d   \        P                  ! S R24       \        ^ ,          p\         P                  ! V4       \        P                  ! \        \        4      P                  S,          V4       \        4       p \        ;QJ d    V3R	 lV  4       F  '       g   K   RM	  RM! V3R	 lV  4       4      '       g   Q hR
# )APPVEYORTF_BUILDznThis test should only run on CI (appveyor or azure) as the developer's font directory should remain unchanged.z4We need to update the registry for this test to workr   c              3   .   <"   T F
  pSV9   x  K  	  R # 5ir   r/   r   s   & r(   rd   (test_user_fonts_win32.<locals>.<genexpr>   r   r   TFr   c              3   .   <"   T F
  pSV9   x  K  	  R # 5ir   r/   r   s   & r(   rd   r      s     8%$~%%r   N)osenvirongetrh   xfailr   r   ri   r   makedirsr   r;   r   r   r   )r   r   r   s     @r(   test_user_fonts_win32r      s    JJNN:&&"**..*D*D " 	# LLGH"N E
s
4e
4sss
4e
444~&&EFG*1-N KK KKX%%6G E38%83338%88888r0   c                     \         P                  ! 4       w  rVP                  \        4       R R7       \         P                  ! 4        R# )rt   ro   N)rw   rx   rz   r   close)_r{   r|   s   &  r(   _model_handlerr      s*    llnGCKK	%K(IIKr0   register_at_forkz Cannot register at_fork handlersc                      \        ^ 4       \        P                  ! R4      p V P                  ^R7      ;_uu_ 4       pVP	                  \         \        ^4      4       RRR4       R#   + '       g   i     R# ; i)r   fork)	processesN)r   multiprocessingget_contextPoolmaprange)ctxpools     r(   	test_forkr      sP     1

%
%f
-C	A		$q* 
			s    A&&A7	c                    R .\         P                  R&   V P                  R4      ;_uu_ 4        \        R4       RRR4       V P                   Uu. uF  qP                  4       NK  	  upRR.8X  g   Q hR#   + '       g   i     LD; iu upi )zthis-font-does-not-existr   WARNINGsansNzFfindfont: Font family ['sans'] not found. Falling back to DejaVu Sans.zufindfont: Generic family 'sans' not found because none of the following families were found: this-font-does-not-exist)rw   rcParamsat_levelr   records
getMessage)caplogrecs   & r(   test_missing_familyr      su    'A&BCLL"#		#	# 
$(.7NN7	'	B<    
$	#7s   A6B	6B	c            	        aaa	 ^ RI p ^ RIHo ^ RIHo	 R pWn        ^
pV P                  V4      oVVV	3R lp\        V4       Uu. uF  pV P                  VRV 2V3R7      NK  	  ppV F  pVP                  4        K  	  V F6  pVP                  ^	R7       VP                  4       '       g   K-  \        R4      h	  R# u upi )	r   N)	LoadFlagsc                     \        R 4      h)zerror in thread!)RuntimeError)argss   &r(   loud_excepthook(_test_threading.<locals>.loud_excepthook  s    -..r0   c                    < SP                  ^R7       \        ^d4       FJ  pSP                  SP                  R4      4      pVP	                  \        V 4      RSP                  R7       KL  	  R# )   timeoutzDejaVu Sansg        )flagsN)waitr   r   r   rW   r   
NO_HINTING)njr&   r   bfms   &  r(   bad_idea!_test_threading.<locals>.bad_idea	  sR    	qsA;;r{{=9:DMM#a&#Y-A-AMB r0   bad_thread_)targetr"   r   r   zthread failed to join)	threadingr   r   matplotlib.font_managerfont_manager
excepthookBarrierr   Threadstartr   is_aliver   )
r   r   Nr   r   threadstr   r   r   s
          @@@r(   _test_threadingr      s    ,(/ +
A!AC qA 	QC/@tL  
 		  	q::<<677 s   !B?c                  T    \         P                  ! R 4       \        \        ^
R7       R# )r   r   N)rh   importorskipr   r   r/   r0   r(   test_fontcache_thread_safer     s    
$/26r0   c                 ~    \        \        P                  R R./ \        P                  CR\        V 4      /CRR7      pR# )z-czlimport matplotlib;import os;p = matplotlib.get_cachedir();os.chmod(p, 0o555);import matplotlib.font_manager;MPLCONFIGDIRT)envcheckN)r   sys
executabler   r   r   )r:   procs   & r(   test_lockfilefailurer  #  s>     &NN.	
 :rzz9>3x=9Dr0   c                     \        R R7      p V P                  4       p\        P                  ! \	        V4      4      pVP
                  ^ 8  g   Q hVP                  ^ 8  g   Q hV P                  4       pVP                  R4      '       g   Q hR# )	font-name)r"   z<img src="data:image/png;base64N)	r	   
_repr_png_r   rE   r   widthheight_repr_html_
startswith)fontentpngimghtmls       r(   test_fontentry_dataclassr  9  sp    [)G



C
**WS\
"C99q==::>> D??=>>>>r0   c                      \         P                  ! \        4      ;_uu_ 4        \        R RR7      p V P	                  4        RRR4       R#   + '       g   i     R# ; i)z/randomr  )rD   r"   N)rh   r   r   r	   r  )r  s    r(   %test_fontentry_dataclass_invalid_pathr  E  s9    	(	)	))+> 
*	)	)	)s   AA	zLinux or OS onlyc                  @   R U u. uF  p \         P                  ! RV 4      NK  	  pp \        VR R7      p\        R R7      p. pW#,            F@  p \        P                  ! V4      p\        V4      pVP                  VP                  4       KB  	  \        \        \        V4      4      4      p\        \        P                  ! 4       4      p	\        V4      \        V	4      8X  g   Q h\        V4      \        V	4      8X  g   Q hW8X  g   Q hR# u up i   \         d     K  i ; i)ttfr   )fontextN)r  )r   _get_data_pathr   r   r   r   appendr"   	Exceptionsortedlistsetr   get_font_namesr$   )
subdir	paths_mpl	fonts_mplfonts_system	ttf_fontsr   r&   r<   available_fontsmpl_font_namess
             r(   test_get_font_namesr&  K  s    ELMW6%%gv6WIM	59I"51LI((	??4(D"4(DTYY'	 ) T#i.12OK6689N3~#66663~#6666,,, N  		s    D	<DDDc                     a  ! R  R4      oV3R lp V ! 4        \         P                  ! 4        F-  p\        VS4      '       g   K  \        P                  ! R4       K/  	  R# )c                       ] tR tRtRtR# )/test_donot_cache_tracebacks.<locals>.SomeObjectia  r/   N)__name__
__module____qualname____firstlineno____static_attributes__r/   r0   r(   
SomeObjectr)  a  s    r0   r/  c            	        < S! 4       p \         P                  ! 4       pVP                  4       pVP                  R R RRR7       \	        4       ;_uu_ 4       p\
        P                  ! 4       ;_uu_ 4        \
        P                  ! R4       VP                  VRR7       RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)rl   aardvarkdoesnotexistr    r3   rr   ro   N)	mfigureFigurerx   ry   r   r7   r8   r9   rz   )xr{   r|   outr/  s       r(   inner*test_donot_cache_tracebacks.<locals>.innerd  s    Lnn\\^RN;YY#((**''1C. + Y** YYs$   C3*B/	C/B?:CC	z#object from inner stack still aliveN)gcget_objects
isinstancerh   fail)r7  objr/  s     @r(   test_donot_cache_tracebacksr>  _  sD     / 
G~~c:&&KK=>  r0   c                 v   \         P                  ! \        P                  4      ;_uu_ 4        \	        RR4       RRR4       \         P                  ! \        P                  4      ;_uu_ 4        \	        R^
R7       RRR4       \         P                  ! \        P                  4      ;_uu_ 4        \	        R.4       RRR4       \	        RRR7       \	        RR7       \	        R4       \	        R4       \	        RR7       R#   + '       g   i     L; i  + '       g   i     L; i  + '       g   i     Ls; i)a;  
Test the deprecated API of FontProperties.__init__.

The deprecation does not change behavior, it only adds a deprecation warning
via a decorator. Therefore, the purpose of this test is limited to check
which calls do and do not issue deprecation warnings. Behavior is still
tested via the existing regular tests.
TimesitalicN)size)r!   styler    z"serif-24:style=oblique:weight=bold)rh   warnsmplMatplotlibDeprecationWarningr
   r/   r0   r(   $test_fontproperties_init_deprecationrG  u  s     
c66	7	7w) 
8 
c66	7	7wR( 
8 
c66	7	7y! 
8
 '2'"778 >?7 
8	7 
8	7 
8	7s#   D.D0D(D	D%	(D8	)            )Hior   r   r9  r   r   pathlibr   PILr   r   r  r7   numpyrY   rh   
matplotlibrE  r   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   rw   r   r   r3  matplotlib.testingr   r   which
has_fclistr)   r1   r>   rJ   markskipifplatformrO   parametrizer_   rj   r~   r   r   r   r   r   r   hasattrr   r   r   r   r  r  r  r&  r>  rG  r/   r0   r(   <module>rY     s     	  	    
    C C C C T S P \\)$D0
0A8 CLLG+==:~4  6,6, <0) 1)$
#+	+" CLLG+==:~A  C(C(2-  CLLG+NC9 D96 $677=  ?+?+	8B7,	? CLLG+4FG- H-&?,$@r0   