+
     ]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                  sL   \        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-serifZcmmi10Bitstream Vera Sans)Zrc
sans-seriffamilyNz
cmmi10.ttfi"  )r   r   r   r   namer   Zget_charmaplen)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t9:
0 
0s   BB#	c                  s   ^ \         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    ZregularZboldi  ZnormalN)r	   Zscore_weight     r    test_score_weightr$   (   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 /r#   c           	      s   \        \        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   ZSTIXGeneralr   weighti  zno such font familyF)Z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                  s   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.otfZotfZrbs   OTTON)r   Zexistsr   r	   ttflistfnameopenZread)r0   ZfZfdZres       r    test_otfr3   B   s    =EE{#E****  AGGaggt$$ggajG+ %.qww7777	 !$$s   9B88CZwin32zno fontconfig installed)Zreasonc                  s:    \        \        4       4      ^8  g   Q hR# )i   N)r   r   r"   r#   r    test_get_fontconfig_fontsr4   M   s     $&'!+++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 V P                  R8X  g   Q h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   r   ).0entry   & r    	<genexpr>Z#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)Znextr	   r/   r&   ZStopIterationpytestskip)r:       r    test_utf16m_sfntr@   f   sZ    	# B(;(; B B ||s"""  HFGHs    7 !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   r   r=   r>   pltsubplotstextsavefigr   )r-   figaxfmtr2   r    test_find_ttcrO   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)rA   u   Hello, 你好rB   rC   N)zNotoSansCJKsc-Regular.otfzNotoSansCJK-Regular.ttcrD   rG   )r-   r   rL   rM   rN   s        r    test_find_notorP   }   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.ft2fontrQ   Z	TypeErrorr   )r*   rQ   r;   r    test_find_invalidrV      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\        ;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"   r9   r   font_test_file   & r    r<   (test_user_fonts_linux.<locals>.<genexpr>        
4ed>T!e   TF already exists in system fontsfonts)ZdirZXDG_DATA_HOMEc              3   rX   rY   r"   rZ   r\   r    r<   r]      s     <ed>T)er_   N)r   anyr=   r>   joinZensureshutilZcopyfiler   __file__parentZcontextZsetenvrT   r   Zcache_clear)ZtmpdirZmonkeypatchra   user_fonts_dirZmr[   s   &&   @r    test_user_fonts_linuxrh      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                 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.rW   c              3   sn   <"   T F*  pVP                   P                  S4      '       g   K&  Vx  K,  	  R # 5irY   )r0   endswithrZ   r\   r    r<   Z'test_addfont_as_path.<locals>.<genexpr>   s,      :#64ZZ((8 $#6s   #5
5N)	r   re   rf   r	   Zaddfontr/   Zremover0   ri   )pathZaddedr   Z	to_remover[   s       @r    test_addfont_as_pathrk      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 \        ;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
# )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 workrW   c              3   rX   rY   r"   rZ   r\   r    r<   (test_user_fonts_win32.<locals>.<genexpr>   r^   r_   TFr`   c              3   rX   rY   r"   rZ   r\   r    r<   rl      s     8%$~%%r_   N)osenvironZgetr=   Zxfailr   rb   r>   r   Zmakedirsrd   r+   r   re   rf   )ra   rg   r[        @r    test_user_fonts_win32rp      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8r#   c                 s    \         P                  ! 4       w  rVP                  \        4       R R7       \         P                  ! 4        R# )rF   rC   N)rH   rI   rK   r   Zclose)Z_rL   rM   s   &  r    _model_handlerrq      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)rq   multiprocessingZget_contextZPoolZmaprange)ZctxZpools     r    	test_forkrt      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       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   ZWARNINGZ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)rH   ZrcParamsZat_levelr   ZrecordsZ
getMessage)ZcaplogZrecr;   r    test_missing_familyru      su    'A&BCLL"#		#	# 
$(.7NN7	'	B<    
$	#7s   A6B	6B	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)argss   &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waitrs   r   r   r6   rT   Z
NO_HINTING)Znjr   rv   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targetr   rx   rz   zthread failed to join)	threadingrU   rv   matplotlib.font_managerZfont_managerZ
excepthookZBarrierrs   ZThreadZstartrc   Zis_aliverw   )
r   ry   ZNr~   r{   ZthreadsZtrv   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   rz   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
executablerm   rn   rT   )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
                  ^ 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   Z
_repr_png_r   r1   r   ZwidthZheight_repr_html_Z
startswith)fontentZpngZimgZhtmlr2   r    test_fontentry_dataclassr   9  sp    [)G



C
**WS\
"C99q==::>> D??=>>>>r#   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   r   N)r=   rR   rS   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	\        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)ttfra   )ZfontextN)r   )r   Z_get_data_pathr   r   rQ   r   Zappendr   Z	ExceptionZsortedZlistZsetr	   Zget_font_namesr   )
ZsubdirZ	paths_mplZ	fonts_mplZfonts_systemZ	ttf_fontsrj   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3~#66663~#6666,,, N  		s    D	<DDD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)rA   ZaardvarkZdoesnotexistr   r%   rE   rC   N)	mfigureZFigurerI   rJ   r   r'   r(   r)   rK   )ZxrL   rM   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   ro   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   rr   rm   Zpathlibr   ZPILr   rd   r   r'   Znumpyr7   r=   Z
matplotlibr   r   r   r   r   r   r	   r
   r   r   r   r   r   r   r   r   r   rH   r   r   r   Zmatplotlib.testingr   r   ZwhichZ
has_fclistr!   r$   r.   r3   ZmarkZskipifZplatformr4   Zparametrizer8   r@   rO   rP   rV   rh   rk   rp   rq   Zhasattrrt   ru   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#   