+
     ]i87  c                   s   ^ 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                  s    \        R RR./R7      ;_uu_ 4        \        \        R.R7      4      p RRR4       \        X 4      pVP	                  4       pR#   + '       g   i     L-; i)font.sans-serifZcmmi10Bitstream Vera Sans)Zrc
sans-seriffamilyN)r   r   r   r   Zget_charmap)ZfontfilefontZcmaps      I/usr/lib64/python3.14/site-packages/matplotlib/tests/test_font_manager.pytest_font_priorityr      s]    	,-/ 
0 
0 N<.AB
0 HDD
0 
0s   AA%	c                      R # N r"       r   test_score_weightr$   (       r#   c                 s8   \        \        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K  	  R	R	R	4       R	#   + '       g   i     R	# ; i)zfontlist.jsonignorez findfont: Font family.*not foundr   ZSTIXGeneralr   Zweighti  zno such font familyNr"   )r
   r	   r   warningscatch_warningsfilterwarningsr   )tmp_pathcopypropfps   &   r   test_json_serializationr.   3   s     k8o56X/0D		 	 	"	"*LM. 5xE 568D  '$'B8 
#	"	"	"s   7BB	c                  s:   R p \        V 4      P                  4       '       d   \        P                   FQ  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       KS  	  R#   + '       g   i     Kh  ; i)z//usr/share/fonts/opentype/freefont/FreeMono.otfZotfZrbs   OTTON)r   Zexistsr	   ttflistfnameopenZread)r0   ZfZfdZres       r   test_otfr3   B   sm    =EE{  AGGaggt$$ggajG+ %$ !$$$s   &B		BZwin32zno fontconfig installed)Zreasonc                  r    r!   r"   r"   r#   r   test_get_fontconfig_fontsr4   M   r%   r#   factorc                 s   \        \        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   )Zhinting_factorZabcg?)ZrtolN)
r   r   r   ZclearZset_sizeset_textZget_width_heightnpZtestingZassert_allclose)r5   r   Zfont1ZexpectedZhinted_fonts   &    r   test_hinting_factorr8   S   s    N<.9:DT!,E	KKM	NN2s	NN5%%'H47KS!JJ{;;=x$'  )r#   c                  s     \        R  \        P                   4       4      p R#   \         d    \        P
                  ! R4        R# i ; i)c              3   sr   "   T F-  p\        VP                  4      P                  R 8X  g   K)  Vx  K/  	  R# 5i)zseguisbi.ttfN)r   r0   name).0entry   & r   	<genexpr>Z#test_utf16m_sfnt.<locals>.<genexpr>i   s1      B(;uU[[)...@ U(;s   &7
7z0Couldn't find seguisbi.ttf font to test against.N)Znextr	   r/   ZStopIterationpytestskip)r;       r   test_utf16m_sfntrA   f   sD    	# B(;(; B B HFGHs    $ !A	A	c                  s2   \        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   ⿓ZfontpropertiesZformatNrawZsvgpdfZpsr   r   r   r9   r>   r?   pltsubplotstextsavefigr   )r-   figaxfmtr2   r   test_find_ttcrP   s   ss    	 34	5BHRL"2289llnGCGGB/GC*GIc* +r#   c                  s@   \        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 Z)rB   u   Hello, 你好rC   rD   N)zNotoSansCJKsc-Regular.otfzNotoSansCJK-Regular.ttcrE   rH   )r-   r9   rM   rN   rO   s        r   test_find_notorQ   }   s    	 24FG	HB""DKKB4&JKllnGCGGCobG9*GIc* +r#   c                 s   \         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)Zmatch)
r>   raisesFileNotFoundErrorr   strZbytesmatplotlib.ft2fontrR   Z	TypeErrorr   )r*   rR   r<   r   test_find_invalidrW      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	Zlinuxz$only Linux with fontconfig installedc                 s  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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r!   r"   r:   r   font_test_file   & r   r=   Z(test_user_fonts_linux.<locals>.<genexpr>        
4ed>T!e   TF already exists in system fontsfonts)ZdirZXDG_DATA_HOMEN)r   anyr>   r?   joinZensureshutilZcopyfiler   __file__parentZcontextZsetenvrU   r   Zcache_clear)ZtmpdirZmonkeypatchr`   user_fonts_dirZmr[   s   &&   @r   test_user_fonts_linuxrg      s     #N E
s
4e
4sss
4e
444~&&EFG [[)Nd#
OODN))N:"''79 
				!	#f+.))+!	 
 %%' 
	s   &;E  E	c                 s  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.rX   c              3   sn   <"   T F*  pVP                   P                  S4      '       g   K&  Vx  K,  	  R # 5ir!   )r0   endswithrZ   r\   r   r=   Z'test_addfont_as_path.<locals>.<genexpr>   s,      :#64ZZ((8 $#6s   #5
5N)	r   rd   re   r	   Zaddfontr/   Zremover0   rh   )pathZaddedr   Z	to_remover[   s       @r   test_addfont_as_pathrj      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                  s  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 R	# )
ZAPPVEYORZ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 workrX   c              3   rY   r!   r"   rZ   r\   r   r=   Z(test_user_fonts_win32.<locals>.<genexpr>   r]   r^   TFr_   N)osenvironZgetr>   Zxfailr   ra   r?   r   Zmakedirsrc   r+   r   rd   re   )r`   rf   r[        @r   test_user_fonts_win32rn      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 Er#   c                 s    \         P                  ! 4       w  rVP                  \        4       R R7       \         P                  ! 4        R# )rG   rD   N)rI   rJ   rL   r   Zclose)Z_rM   rN   s   &  r   _model_handlerro      s*    llnGCKK	%K(IIKr#   Zregister_at_forkz Cannot register at_fork handlersc                  s    \        ^ 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    Zfork)Z	processesN)ro   multiprocessingZget_contextZPoolZmaprange)ZctxZpools     r   	test_forkrr      sP     1

%
%f
-C	A		$q* 
			s    A&&A7	c                 s    R .\         P                  R&   V P                  R4      ;_uu_ 4        \        R4       RRR4       R#   + '       g   i     R# ; i)zthis-font-does-not-existr   ZWARNINGZsansN)rI   ZrcParamsZat_levelr   )Zcaplog   &r   test_missing_familyrt      s:    'A&BCLL"#		#	# 
$	#	#	#s   AA	c            	      s  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                 s    \        R 4      h)zerror in thread!)RuntimeError)argsrs   r   loud_excepthookZ(_test_threading.<locals>.loud_excepthook  s    -..r#   c                 s   < 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# )i   ZtimeoutzDejaVu Sansg        )ZflagsN)Zwaitrq   r   r   r6   rU   Z
NO_HINTING)Znjr   ru   bfms   &  r   bad_ideaZ!_test_threading.<locals>.bad_idea	  sR    	qsA;;r{{=9:DMM#a&#Y-A-AMB r#   Zbad_thread_)Ztargetr9   rw   ry   zthread failed to join)	threadingrV   ru   matplotlib.font_managerZfont_managerZ
excepthookZBarrierrq   ZThreadZstartrb   Zis_aliverv   )
r~   rx   ZNr}   rz   ZthreadsZtru   r{   r|   s
          @@@r   _test_threadingr      s    ,(/ +
A!AC qA 	QC/@tL  
 		  	q::<<677 s   !B?c                  sT    \         P                  ! R 4       \        \        ^
R7       R# )r~   ry   N)r>   Zimportorskipr   r   r"   r#   r   test_fontcache_thread_safer     s    
$/26r#   c                 s~    \        \        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;ZMPLCONFIGDIRT)ZenvZcheckN)r   sysZ
executablerk   rl   rU   )r*   Zprocr<   r   test_lockfilefailurer   #  s>     &NN.	
 :rzz9>3x=9Dr#   c                  s    \        R R7      p V P                  4       p\        P                  ! \	        V4      4      pV P                  4       pR# )	font-name)r9   N)r   Z
_repr_png_r   r1   r   _repr_html_)fontentZpngZimgZhtmlr2   r   test_fontentry_dataclassr   9  s<    [)G



C
**WS\
"C  Dr#   c                  s    \         P                  ! \        4      ;_uu_ 4        \        R RR7      p V P	                  4        RRR4       R#   + '       g   i     R# ; i)z/randomr   )r0   r9   N)r>   rS   rT   r   r   )r   r@   r   %test_fontentry_dataclass_invalid_pathr   E  s9    	(	)	))+> 
*	)	)	)s   AA	zLinux or OS onlyc                  s   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	R# u up i   \         d     K  i ; i)ttfr`   )ZfontextN)r   )r   Z_get_data_pathr   r   rR   r   Zappendr9   Z	ExceptionZsortedZlistZsetr	   Zget_font_names)
ZsubdirZ	paths_mplZ	fonts_mplZfonts_systemZ	ttf_fontsri   r   r,   Zavailable_fontsZ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 N  		s    C<CCCc                  s   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                   s    ] tR tRtRtR# )/test_donot_cache_tracebacks.<locals>.SomeObjectia  r"   N)Z__name__Z
__module__Z__qualname__Z__firstlineno__Z__static_attributes__r"   r#   r   
SomeObjectr   a  s    r#   r   c            	      s  < 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)rB   ZaardvarkZdoesnotexistr   r&   rF   rD   N)	mfigureZFigurerJ   rK   r   r'   r(   r)   rL   )ZxrM   rN   Zoutr   s       r   innerZ*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)gcZget_objectsZ
isinstancer>   Zfail)r   Zobjr   rm   r   test_donot_cache_tracebacksr   _  sD     / 
G~~c:&&KK=>  r#   c                 sv   \         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.
ZTimesZitalicN)Zsize)r   Zstyler   z"serif-24:style=oblique:weight=bold)r>   ZwarnsmplZMatplotlibDeprecationWarningr   r"   r#   r   $test_fontproperties_init_deprecationr   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	)i   i   i   i   )HZior   r   r   rp   rk   Zpathlibr   ZPILr   rc   r   r'   Znumpyr7   r>   Z
matplotlibr   r   r   r   r   r   r	   r
   r   r   r   r   r   r   r   r   r   rI   r   r   r   Zmatplotlib.testingr   r   ZwhichZ
has_fclistr   r$   r.   r3   ZmarkZskipifZplatformr4   Zparametrizer8   rA   rP   rQ   rW   rg   rj   rn   ro   Zhasattrrr   rt   r   r   r   r   r   r   r   r   r"   r#   r   <module>r      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-&?,$@r#   