
    h                        S SK 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J	r	  S SK
Jr  S SKJr  S SKJr  S SKJr  S rS rS rS rS	 rS
 rS rS rSSSSSSSSSSSSSS.SSSSSSSS.SSS S!S"S#S"S$S%S&S'S(S)S*S+.S,.r\R<                  R?                  S-\RA                  5       \RC                  5       S.9S/ 5       r"S0 S0S1_S2S3_S4S5_S6S7_S8S9_S:S;_S<S=_S>S=_S?S@_SASB_SCSD_SESF_SGS _SHSI_SJS _SKSL_SMS _S1SNSOSPSQSRSSSTSUSVS SWSXSISYSZ.0 S0SL_S[S\_S]S^_S_S`_SaS _SbSc_SdSe_SfS _SgSh_SiSc_SjSe_SkS _SlSm_SnSo_SpSq_SrS _SsSt_SuSvSVSwSxSy.ES1SzS{S S|S@S}SDSLS S S S~S.SSS SSSS S S S S.	SS.S0 S0S1_S2S1_S4S_S6S7_S8S_S:S;_S<S_S>S_S?S_SAS_SCS_SES_SGS _SHS_SJST_SKSL_SMS _S1SSS SSS`S STSSVS SSSYSLSZ.0 S0S _S[S_S]S^_S_S`_SaS _SbS_SdS_SfS _SgS_SiS_SjS_SkS _SlS_SnSo_SpSq_SrS _SsS_SSSVSwSSy.ES1SSS SSSSSLS S S SS.SSS SSSS S S S S.	S1SSSS S SS SSS SSVS.S.S0 S0S1_S2S1_S4S_S6S7_S8S_S:S_S<S_S>S_S?SY_SAS_SCS_SES_SGSL_SHSI_SJST_SKS _SMS _S1SSS S SLS STSLSVS SVS S S SZ.0 S0ST_S[S_S]S_S_S`_SaS _SbS_SdS_SfS _SgS_SiS_SjS_SkS _SlS_SnS_SpS_SrS _SsS_SSSwSwSSy.ES1SSS SS SSSLS S S SS.SSS SSSS S S S S.	SS.S,.r#\R<                  R?                  S\#RC                  5       5      \R<                  R?                  S\#S   RC                  5       5      S 5       5       r$\R<                  R?                  S/ SQ5      S 5       r%S r&S r'S r(S r)\R<                  R?                  S/ SQ5      S 5       r*\R<                  R?                  S/ SQ5      \" / SQS9S 5       5       r+\R<                  R?                  SSS/S//SS/S.9S 5       r,\R<                  R?                  S/ SQ5      S 5       r-g)    N)Path)ft2font)check_figures_equalc                      Sn Sn[         R                  " SS/SS/SS/S	S
/5       H  u  p#pE[        R                  " X5      nUR	                  X#XE5        [
        R                  " U5      nUR                  [
        R                  :X  d   eUR                  X4:X  d   eUS:X  d  US:X  a  [
        R                  " U5      S:X  d   eM  [        US-   U 5      U-
  [        US-   U5      U-
  -  n[
        R                  " U5      SU-  :X  a  M   e   g )N   *      d                 i   r      )	itertoolsproductr   FT2Imagedraw_rect_fillednpasarraydtypeuint8shapesummin)	widthheightx0y0x1y1imafilleds	            O/var/www/html/env/lib/python3.13/site-packages/matplotlib/tests/test_ft2font.pytest_ft2image_draw_rect_filledr&      s    EF#++QHq#hC1c(Se,
BB+JJrNww"(("""ww6/)))9c	66!9>!> "q&%(2-#b1ff2E2JKF66!9f,,, T    c                     [         R                  " S5      n [        R                  " U 5      nUR                  U :X  d   eUR
                  S:X  d   eUR                  S:X  d   eUR                  S:X  d   eUR                  S:X  d   eUR                  S:X  d   eUR                  S:X  d   eUR                  S:X  d   eUR                  S:X  d   e[        R                  R                  [        R                  R                  -  [        R                  R                   -  [        R                  R"                  -  [        R                  R$                  -  nX!R&                  ;   d   eUR(                  [        R*                  R,                  :X  d   eUR.                  (       d   eUR0                  S:X  d   eUR2                  S	:X  d   eUR4                  S
:X  d   eUR6                  S:X  d   eUR8                  S:X  d   eUR:                  S:X  d   eUR<                  S:X  d   eUR>                  S:X  d   eUR@                  S:X  d   eg )NDejaVu Sans
DejaVuSansBookr	   r   a        iQZ   m  iP	    )LY  	  )!fmfindfontr   FT2Fontfnamepostscript_namefamily_name
style_name	num_facesnum_named_instances
num_glyphsnum_fixed_sizesnum_charmaps	FaceFlagsSCALABLESFNT
HORIZONTALKERNINGGLYPH_NAMES
face_flagsstyle_flags
StyleFlagsNORMALscalableunits_per_EMunderline_positionunderline_thicknessascender	descenderr   max_advance_widthmax_advance_heightbboxfilefontexpected_flagss      r%   test_ft2font_dejavu_attrsrZ   "   s   ;;}%D??4 D::<///},,,??f$$$>>Q##q(((??d"""1$$$!!!''0073D3D3I3II''2235<5F5F5N5NO''334N __,,,w1188888===$$$""d***##r)))==D   >>T!!!;;$!!T)))""d***991111r'   c                  V   [         R                  " S5      n [        R                  " U 5      nUR                  U :X  d   eUR
                  S:X  d   eUR                  S:X  d   eUR                  S:X  d   eUR                  S:X  d   eUR                  S:X  d   eUR                  S:X  d   eUR                  S:X  d   eUR                  S:X  d   e[        R                  R                  [        R                  R                  -  [        R                  R                   -  [        R                  R"                  -  nX!R$                  ;   d   eUR&                  [        R(                  R*                  :X  d   eUR,                  (       d   eUR.                  S:X  d   eUR0                  S	:X  d   eUR2                  S
:X  d   eUR4                  S:X  d   eUR6                  S:X  d   eUR8                  S:X  d   eUR:                  S:X  d   eUR<                  S:X  d   eUR>                  S:X  d   eg )Ncmtt10Cmtt10Regularr	   r      r   r.   iq     i     )#     ) r7   r8   r   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rH   rI   rJ   rK   rL   rM   rN   rO   rP   rQ   rR   r   rS   rT   rU   rV   s      r%   test_ft2font_cm_attrsrh   D   s   ;;x D??4 D::8+++x'''??i'''>>Q##q(((??c!!!1$$$!!!''0073D3D3I3II''2235<5F5F5R5RSN__,,,w1188888===$$$""d***##r)))==D   >>T!!!;;$!!T)))""d***99////r'   c                  V   [         R                  " S5      n [        R                  " U 5      nUR                  U :X  d   eUR
                  S:X  d   eUR                  S:X  d   eUR                  S:X  d   eUR                  S:X  d   eUR                  S:X  d   eUR                  S:X  d   eUR                  S:X  d   eUR                  S:X  d   e[        R                  R                  [        R                  R                  -  [        R                  R                   -  [        R                  R"                  -  nX!R$                  ;   d   eUR&                  [        R(                  R*                  :X  d   eUR,                  (       d   eUR.                  S	:X  d   eUR0                  S
:X  d   eUR2                  S:X  d   eUR4                  S:X  d   eUR6                  S:X  d   eUR8                  S:X  d   eUR:                  S:X  d   eUR<                  S:X  d   eUR>                  S:X  d   eg )NSTIXSizeTwoSym:boldSTIXSizeTwoSym-BoldSTIXSizeTwoSymBoldr	   r   r`        {/  li	  j  )r     rq   ) r7   r8   r   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rH   rI   rJ   rK   BOLDrM   rN   rO   rP   rQ   rR   r   rS   rT   rU   rV   s      r%   test_ft2font_stix_bold_attrsrw   e   s   ;;,-D??4 D::#8888////??f$$$>>Q##q(((??b   1$$$!!!''0073D3D3I3II''2235<5F5F5R5RSN__,,,w1166666===$$$""d***##r)))==D   >>T!!!;;$!!T)))""d***99----r'   c                 :   [         R                  " [        SS9   [        R                  " S 5        S S S 5        [         R                  " [        SS9   [        R                  " [        5       5        S S S 5        U S-  nUR                  S5        [         R                  " [        SS9   UR                  S5       n[        R                  " U5        S S S 5        S S S 5        [         R                  " [        SS9   UR                  S5       n[        R                  " U5        S S S 5        S S S 5        [         R                  " [        SS9   UR                  S5       n[        R                  " U5        S S S 5        S S S 5        [        R                  " S5      n[         R                  " [        S	S9   [        R                  " US
5        S S S 5        [         R                  " [        SS9   [        R                  " US5        S S S 5        [         R                  " [        S	S9   [        R                  " USS9  S S S 5        [         R                  " [        S	S9   [        R                  " US/S9  S S S 5        [         R                  " [        S	S9   [        R                  " US
S9  S S S 5        g ! , (       d  f       GN= f! , (       d  f       GN\= f! , (       d  f       GN= f! , (       d  f       GN= f! , (       d  f       GN= f! , (       d  f       GN= f! , (       d  f       GN= f! , (       d  f       GN= f! , (       d  f       GN= f! , (       d  f       GNX= f! , (       d  f       GN3= f! , (       d  f       GN= f! , (       d  f       g = f)Nz+to a font file or a binary-mode file objectmatchzinvalid-font.ttfzThis is not a valid font file.rtwtwbr)   z"incompatible constructor argumentsg?z%hinting_factor must be greater than 0r   r   )_fallback_list)_kerning_factor)pytestraises	TypeErrorr   r9   object
write_textopenr7   r8   
ValueError)tmp_pathrW   fds      r%   test_ft2font_invalid_argsr      s=   	y(U	V 
W	y(U	V! 
W((DOO45
--	)V
W
))D/R  X --	)V
W
))D/R  X --	)V
W
))D/R  X ;;}%D 
y(L	Mc" 
N	z)P	Qa  
R 
y(L	MT2 
N 
y(L	MaS1 
N 
y(L	Mc2 
N	M? 
W	V	V	V
 / X
W / X
W / X
W 
N	M	Q	Q 
N	M 
N	M 
N	Ms   J4K(K*:KK*:LK<#LL2L 5L24M-M&M(M:N4
K
K
K'	"K**
K9<
L	L
L 
L/	*L22
M
M
M%(
M7:
N	
Nc                  *   [         R                  " S5      n [        R                  " U 5      nUR	                  5       S:X  d   eUR                  5       S:X  d   eUR                  5       S:X  d   eUR                  S5        UR	                  5       S:X  d   eUR                  5       S:w  d   eUR                  5       S:w  d   eUR                  5         UR	                  5       S:X  d   eUR                  5       S:X  d   eUR                  5       S:X  d   eg )Nr)   r   r   r   ABabCDcdr   )	r7   r8   r   r9   get_num_glyphsget_width_heightget_bitmap_offsetset_textclear)rW   rX   s     r%   test_ft2font_clearr      s   ;;}%D??4 D A%%%  "f,,,!!#v---MM* A%%%  "f,,,!!#v---JJL A%%%  "f,,,!!#v---r'   c                     [         R                  " S5      n [        R                  " U SSS9nUR	                  S5        UR                  5       nUR                  SS5        UR	                  S5        UR                  5       [        S U 5       5      :X  d   eUR                  SS	5        UR	                  S5        UR                  5       [        S
 U 5       5      :X  d   eg )Nr)   r	   hinting_factorr   r      H   c              3   V   #    U  H  n[         R                  " S U-  S5      v   M!     g7fr   g?Nr   approx.0xs     r%   	<genexpr>(test_ft2font_set_size.<locals>.<genexpr>   $     +UPT1FMM!a%,F,FPT   ')      c              3   V   #    U  H  n[         R                  " S U-  S5      v   M!     g7fr   r   r   s     r%   r   r      r   r   )r7   r8   r   r9   r   r   set_sizetuple)rW   rX   origs      r%   test_ft2font_set_sizer      s    ;;}%D??41EDMM*  "DMM"bMM*  "e+UPT+U&UUUUMM"cMM*  "e+UPT+U&UUUUr'   c                  V   S n [         R                  " S5      n[        R                  " U5      nUR                  S:X  d   eUR                  U " S5      5        UR                  5       nUR                  S5        UR                  5       n[        U5      [        U5      ::  d   eUR                  5        H(  u  pVX5   Us=:X  a  UR                  U5      :X  a  M%   e   e   UR                  S5        UR                  5       nX4:X  d   eUR                  S5        UR                  5       n[        U5      [        U5      ::  d   eUR                  5        H(  u  pVX5   Us=:X  a  UR                  U5      :X  a  M%   e   e   UR                  S5        UR                  5       nX4:X  d   eSS	S
SSSSSSSSS.nUR                  5        H;  u  pUR                  U5      U	:X  d   eUS:X  a  SnUR                  U	5      U:X  a  M;   e   UR                  U " S5      5        UR                  5       n
UR                  S5        UR                  5       nX:X  d   e[        U
5      S::  d   e[        SS5       H  nX;  d  X;  a  M  X;   X   :X  a  M   e   / SQnU H  u  pX=   X   :X  a  M   e   g )Nc                 B    SnU  H  nUS-  nU[        U5      -  nM     U$ )Nr   r   )ord)nameer   s      r%   enc"test_ft2font_charmaps.<locals>.enc   s0     A!GAQKA  r'   r)   r-   unicr   r	   rn   r   s   i  i  i  i  i  i  ip  i"  i  )non-existent-glyph-name	plusminusRacuteperthousandseveneighthstriagupuni01D3uni0417uni2A02u1D305u1F0A1r   z.notdefarmnr         ))i       )      )   r   )      )      )i"  r   )r7   r8   r   r9   rB   select_charmapget_charmapset_charmaplenitemsget_char_indexget_name_indexget_glyph_namerange)r   rW   rX   r   afterchrglyphglyph_namesr   indexr   oexamplesums                  r%   test_ft2font_charmapsr      s    ;;}%D??4 D!!! 	F$DQEu:T"""kkm
yE=T%8%8%====== $QE==QEu:T"""kkm
yE=T%8%8%====== $QE== $%K #((*""4(E111,,D""5)T111 + 	F$DQE==t91c]=AMw$'!!! 
H w$'!!! r'   zCopyright (c) 2003 by Bitstream, Inc. All Rights Reserved.
Copyright (c) 2006 by Tavmjong Bah. All Rights Reserved.
DejaVu changes are in public domain
r)   r+   zVersion 2.35r*   zDejaVu fonts teamzhttp://dejavu.sourceforge.neta  Fonts are (c) Bitstream (see below). DejaVu changes are in public domain. Glyphs imported from Arev fonts are (c) Tavmjung Bah (see below)

Bitstream Vera Fonts Copyright
------------------------------

Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is
a trademark of Bitstream, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of the fonts accompanying this license ("Fonts") and associated
documentation files (the "Font Software"), to reproduce and distribute the
Font Software, including without limitation the rights to use, copy, merge,
publish, distribute, and/or sell copies of the Font Software, and to permit
persons to whom the Font Software is furnished to do so, subject to the
following conditions:

The above copyright and trademark notices and this permission notice shall
be included in all copies of one or more of the Font Software typefaces.

The Font Software may be modified, altered, or added to, and in particular
the designs of glyphs or characters in the Fonts may be modified and
additional glyphs or characters may be added to the Fonts, only if the fonts
are renamed to names not containing either the words "Bitstream" or the word
"Vera".

This License becomes null and void to the extent applicable to Fonts or Font
Software that has been modified and is distributed under the "Bitstream
Vera" names.

The Font Software may be sold as part of a larger software package but no
copy of one or more of the Font Software typefaces may be sold by itself.

THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT,
TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME
FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING
ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE
FONT SOFTWARE.

Except as contained in this notice, the names of Gnome, the Gnome
Foundation, and Bitstream Inc., shall not be used in advertising or
otherwise to promote the sale, use or other dealings in this Font Software
without prior written authorization from the Gnome Foundation or Bitstream
Inc., respectively. For further information, contact: fonts at gnome dot
org. 

Arev Fonts Copyright
------------------------------

Copyright (c) 2006 by Tavmjong Bah. All Rights Reserved.

Permission is hereby granted, free of charge, to any person obtaining
a copy of the fonts accompanying this license ("Fonts") and
associated documentation files (the "Font Software"), to reproduce
and distribute the modifications to the Bitstream Vera Font Software,
including without limitation the rights to use, copy, merge, publish,
distribute, and/or sell copies of the Font Software, and to permit
persons to whom the Font Software is furnished to do so, subject to
the following conditions:

The above copyright and trademark notices and this permission notice
shall be included in all copies of one or more of the Font Software
typefaces.

The Font Software may be modified, altered, or added to, and in
particular the designs of glyphs or characters in the Fonts may be
modified and additional glyphs or characters may be added to the
Fonts, only if the fonts are renamed to names not containing either
the words "Tavmjong Bah" or the word "Arev".

This License becomes null and void to the extent applicable to Fonts
or Font Software that has been modified and is distributed under the 
"Tavmjong Bah Arev" names.

The Font Software may be sold as part of a larger software package but
no copy of one or more of the Font Software typefaces may be sold by
itself.

THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL
TAVMJONG BAH BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

Except as contained in this notice, the name of Tavmjong Bah shall not
be used in advertising or otherwise to promote the sale, use or other
dealings in this Font Software without prior written authorization
from Tavmjong Bah. For further information, contact: tavmjong @ free
. fr.z4http://dejavu.sourceforge.net/wiki/index.php/License)r   r	   r   rn   r   r-      r                  z_Copyright (C) 1994, Basil K. Malyshev. All Rights Reserved.012BaKoMa Fonts Collection, Level-B.r\   r^   zFontMonger:cmtt10z1.1/12-Nov-94r]   )r   r	   r   rn   r   r-   r   a  Copyright (c) 2001-2010 by the STI Pub Companies, consisting of the American Chemical Society, the American Institute of Physics, the American Mathematical Society, the American Physical Society, Elsevier, Inc., and The Institute of Electrical and Electronic Engineers, Inc. Portions copyright (c) 1998-2003 by MicroPress, Inc. Portions copyright (c) 1990 by Elsevier, Inc. All rights reserved.rl   rm   z$FontMaster:STIXSizeTwoSym-Bold:1.0.0rk   zVersion 1.0.0z\STIX Fonts(TM) is a trademark of The Institute of Electrical and Electronics Engineers, Inc.zbMicroPress Inc., with final additions and corrections provided by Coen Hoffman, Elsevier (retired)a  Arie de Ruiter, who in 1995 was Head of Information Technology Development at Elsevier Science, made a proposal to the STI Pub group, an informal group of publishers consisting of representatives from the American Chemical Society (ACS), American Institute of Physics (AIP), American Mathematical Society (AMS), American Physical Society (APS), Elsevier, and Institute of Electrical and Electronics Engineers (IEEE). De Ruiter encouraged the members to consider development of a series of Web fonts, which he proposed should be called the Scientific and Technical Information eXchange, or STIX, Fonts. All STI Pub member organizations enthusiastically endorsed this proposal, and the STI Pub group agreed to embark on what has become a twelve-year project. The goal of the project was to identify all alphabetic, symbolic, and other special characters used in any facet of scientific publishing and to create a set of Unicode-based fonts that would be distributed free to every scientist, student, and other interested party worldwide. The fonts would be consistent with the emerging Unicode standard, and would permit universal representation of every character. With the release of the STIX fonts, de Ruiter's vision has been realized.zhttp://www.stixfonts.orgzhttp://www.micropress-inc.coma  As a condition for receiving these fonts at no charge, each person downloading the fonts must agree to some simple license terms. The license is based on the SIL Open Font License <http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=OFL>. The SIL License is a free and open source license specifically designed for fonts and related software. The basic terms are that the recipient will not remove the copyright and trademark statements from the fonts and that, if the person decides to create a derivative work based on the STIX Fonts but incorporating some changes or enhancements, the derivative work ("Modified Version") will carry a different name. The copyright and trademark restrictions are part of the agreement between the STI Pub companies and the typeface designer. The "renaming" restriction results from the desire of the STI Pub companies to assure that the STIX Fonts will continue to function in a predictable fashion for all that use them. No copy of one or more of the individual Font typefaces that form the STIX Fonts(TM) set may be sold by itself, but other than this one restriction, licensees are free to sell the fonts either separately or as part of a package that combines other software or fonts with this font set.z*http://www.stixfonts.org/user_license.html)r   r	   r   rn   r   r-   r      	   
   r   r   r   r   )r)   r\   rj   zfont_name, expected)idsc                 f   [         R                  " U 5      n[        R                  " U5      nUR	                  5       nUR                  5        HY  u  pVUR                  SSSU45      UR                  S5      :X  d   eUR                  SSSU45      UR                  S5      :X  a  MY   e   U0 :X  d   eg )Nr	   r   asciirn   i	  zutf-16be)r7   r8   r   r9   get_sfntr   popencode)	font_nameexpectedrW   rX   sfntr   values          r%   test_ft2font_get_sfntr     s     ;;y!D??4 D==?D~~'xxAq$(ELL,AAAAxxAtT*+u||J/GGGG	 (
 2::r'   version)r	   r   fontRevision)r   iY  checkSumAdjustmenti[magicNumberi<_flags   
unitsPerEmr.   created)r   l   " modifiedxMinr3   yMinr4   xMaxr5   yMaxr6   macStylelowestRecPPEMr   fontDirectionHintindexToLocFormatr	   glyphDataFormatr,   iT  h   r   +   r   r      @   i  i  r   )r   	numGlyphs	maxPointsmaxComponentPointsmaxTwilightPointsmaxContoursmaxComponentContoursmaxZones
maxStoragemaxFunctionDefsmaxInstructionDefsmaxStackElementsmaxSizeOfInstructionsmaxComponentElementsmaxComponentDepthxAvgCharWidthi  usWeightClassr   usWidthClassr-   fsTypeySubscriptXSizei3  ySubscriptYSizei  ySubscriptXOffsetySubscriptYOffseti  ySuperscriptXSizeySuperscriptYSizeySuperscriptXOffsetySuperscriptYOffseti  yStrikeoutSizef   yStrikeoutPositioni  sFamilyClasspanoses
   )l   n N l   }$ i)`$
i  s   PfEd    i  )ulCharRange	achVendIDfsSelectionfsFirstCharIndexfsLastCharIndexr0   r1   r2   iQiR  )r   ascentdescentlineGapadvanceWidthMaxminLeftBearingminRightBearing
xMaxExtentcaretSlopeRisecaretSlopeRuncaretOffsetmetricDataFormatnumOfLongHorMetrics)r   r   r   i~r/   )	formatisFixedPitchitalicAngleunderlinePositionunderlineThicknessminMemType42maxMemType42minMemType1maxMemType1)invalidheadmaxpzOS/2hheavheapostpcltiO!rn   rd   re   rf   rg   r   r_   ^   r   r
   i3  i  iq  i+iB  s
          )r   r   r   r   s       ik&  ra   rb   rc   irp   r`   l        i  s   cmtt10          s   7)r   
fontNumberpitchxHeightstyle
typeFamily	capHeight	symbolSettypeFacecharacterComplementstrokeWeight	widthType
serifStylei}kr   ro   )r   l   Qm rt   ru   rq   %   iV  i  i     i  s
             )rn      r   r   s   STIXi'  rr   rs   i   ir   headerc                     [         R                  " U 5      n[        R                  " U5      nUR	                  U5      [
        U    U   :X  d   eg N)r7   r8   r   r9   get_sfnt_table_expected_sfnt_tables)r   rZ  rW   rX   s       r%   test_ft2font_get_sfnt_tabler_    sD     ;;y!D??4 Dv&*?	*J6*RRRRr'   z(left, right, unscaled, unfitted, default)
)Ar`  9      r   )r`     Àra  rb  r   )r`     Ára  rb  r   )r`     Âra  rb  r   )r`     Ãra  rb  r   )r`     Ära  rb  r   )Dr`  iidi)T.iii )XCikiyi)-Jr   i     c           	         [         R                  " S5      n[        R                  " USSS9nUR	                  SS5        UR                  UR                  [        U 5      5      UR                  [        U5      5      [        R                  R                  5      U:X  d   eUR                  UR                  [        U 5      5      UR                  [        U5      5      [        R                  R                  5      U:X  d   eUR                  UR                  [        U 5      5      UR                  [        U5      5      [        R                  R                  5      U:X  d   e[        R                  " [        R                  SS9   [        R                   nS S S 5        [        R                  " [        R                  SS9   UR                  UR                  [        U 5      5      UR                  [        U5      5      [#        W5      5      U:X  d   e S S S 5        [        R                  " [        R                  S	S9   [        R$                  nS S S 5        [        R                  " [        R                  SS9   UR                  UR                  [        U 5      5      UR                  [        U5      5      [#        W5      5      U:X  d   e S S S 5        [        R                  " [        R                  S
S9   [        R&                  nS S S 5        [        R                  " [        R                  SS9   UR                  UR                  [        U 5      5      UR                  [        U5      5      [#        W5      5      U:X  d   e S S S 5        g ! , (       d  f       GN= f! , (       d  f       GN= f! , (       d  f       GNn= f! , (       d  f       GN= f! , (       d  f       N= f! , (       d  f       g = f)Nr)   r	   r   r   r
   zUse Kerning.UNSCALED insteadry   zUse Kerning enum values insteadzUse Kerning.UNFITTED insteadzUse Kerning.DEFAULT instead)r7   r8   r   r9   r   get_kerningr   r   KerningUNSCALEDUNFITTEDDEFAULTr   warnsmplMatplotlibDeprecationWarningKERNING_UNSCALEDintKERNING_UNFITTEDKERNING_DEFAULT)leftrightunscaledunfitteddefaultrW   rX   ks           r%   test_ft2font_get_kerningr    s)    ;;}%D??41EDMM#sD//D	: //E
;#OO4469AB B B D//D	: //E
;#OO4469AB B B D//D	: //E
;#OO3358?@ @ @ 
c66:
<$$
< 
c66=
? 3 3CI > $ 3 3CJ ? #A(+34 	4 4
?
 
c66:
<$$
< 
c66=
? 3 3CI > $ 3 3CJ ? #A(+34 	4 4
?
 
c669
;##
; 
c66=
? 3 3CI > $ 3 3CJ ? #A(+23 	3 3
? 
?'
< 
<
? 
?

< 
<
? 
?

; 
;
? 
?sK   NAN& N8<AO
;O7AO-
N#&
N58
O

O
O*-
O;c                     [         R                  " S5      n [        R                  " U SSS9nUR	                  S5      n[
        R                  R                  U[
        R                  " S5      5        UR                  5       S:X  d   eUR                  5       S:X  d   eUR                  5       S:X  d   eUR                  5       S:X  d   eUR	                  S5      n[
        R                  R                  U/ S	Q5        UR                  5       S
:X  d   eUR                  5       S:X  d   eUR                  5       S:X  d   eUR                  5       S:X  d   eg )Nr)   r	   r   r    r   r   r   z
AADAT.XC-J)
r   )rp  r   )i   r   )i@  r   )i@  r   )i	  r   )i
  r   )i  r   )i  r   )i  r   )i  i   r   rX  )r   r   )r7   r8   r   r9   r   r   testingassert_array_equalemptyr   r   get_descentr   )rW   rX   xyss      r%   test_ft2font_set_textr    s/   ;;}%D??41ED
--
CJJ!!#rxx'78  "f,,, A%%%"""!!#v---
--
%CJJ!!	*+   "k111 B&&&$$$!!#v---r'   c                     [         R                  " S5      n [        R                  " U SSS9nUR	                  [        S5      5      UR                  UR                  [        S5      5      5      4 H  nUc   eUR                  S:X  d   eUR                  S:X  d   eUR                  S:X  d   eUR                  S:X  d   eUR                  S:X  d   eUR                  S:X  d   eUR                  S	:X  d   eUR                  S
:X  d   eUR                   S:X  d   eUR"                  S:X  a  M   e   UR%                  5       S:X  d   eUR'                  5       S:X  d   eUR)                  5       S:X  d   eUR+                  5       S:X  d   eg )Nr)   r	   r   r   M@  i  iZ
 ir  i@  )6   r   i>  r  r   r   )r7   r8   r   r9   	load_charr   
load_glyphr   r   r   horiBearingXhoriBearingYhoriAdvancelinearHoriAdvancevertBearingXvertBearingYvertAdvancerU   r   r   r  r   )rW   rX   r   s      r%   test_ft2font_loadingr    s   ;;}%D??41ED..S*//$"5"5c#h"?@B   {{c!!!||s"""!!Q&&&!!S(((  C'''&&&000!!T)))!!R'''  C'''zz....B  A%%%  "f,,,"""!!#v---r'   c                     Sn [         R                  " U  VVs/ s H.  oR                  SS5       Vs/ s H  n[        U5      PM     snPM0     snn5      nUS-  n[        R
                  " S5      n[        R                  " USSS9nUR                  S	5        UR                  S
S9  UR                  5       n[         R                  R                  Xc5        [        R                  " USSS9nUR                  [        S	5      5      n[        R                  " UR                   S   UR                   S   5      nUR#                  USSUS
S9  [         R                  R                  Xc5        g s  snf s  snnf )N)
          
11    11  r  
1 1  1 1  r  r  
1  11  1  r  
1      1  r  r   0r   r)   r	   r   r   r  F)antialiased)r   arrayreplacer{  r7   r8   r   r9   r   draw_glyphs_to_bitmap	get_imager  r  r  r   r   r   draw_glyph_to_bitmap)expected_strlinecr   rW   rX   imager   s           r%   test_ft2font_drawingr    s1   L xx=I=ITc3/0/AQ/0\ H OH;;}%D??41EDMM#51NNEJJ!!%2??41EDNN3s8$EX^^A.q0ABEeREuEJJ!!%2 	1s   E.
E)E.
)E.
c                     [         R                  " S5      n [        R                  " U SSS9nUR	                  5       u  p#UR
                  S:X  d   eUR
                  S:X  d   eUR                  [        S5      5        UR	                  5       u  p#[        R                  " / SQ5      n[        R                  R                  X$5        [        R                  " UR
                  S   [        R                  R                  [        R                  R                   S	9n[        R                  R"                  US'   [        R                  R$                  US
'   [        R                  R                  X55        g )Nr)   r	   r   r   r  r~   r  )      ?      "@)g     @r  )g     @g      @)g     @r  )     !@r  )r          )     `@r  )r       @)g      @     ?)g     0@r  )     ?r  )r  r  )r  r  r  )r  r  )r   r  )r7   r8   r   r9   get_pathr   r  r   r   r  r  r  fullmpathr   LINETO	code_typeMOVETO	CLOSEPOLY)rW   rX   verticescodesexpected_verticesexpected_codess         r%   test_ft2font_get_pathr  >  s   ;;}%D??41EDmmoOH>>V###;;%NN3s8mmoOH "  JJ!!(>WW.44Q79J9J#(::#7#79N

))N1--N2JJ!!%8r'   zfamily_name, file_name))WenQuanYi Zen Heizwqy-zenhei.ttc)Noto Sans CJK JPzNotoSansCJK.ttczNoto Sans TCzNotoSansTC-Regular.otfc                    [         R                  " U /S9n[        [         R                  " U5      5      R                  U:w  a  [
        R                  " SU  SU S35        S[        R                  S'   [        R                  " SS9nUR                  S	S
SSU /S9  UR                  S	SSU /S9  S H&  nUR                  [        R                  " 5       US9  M(     g )NfamilyFont  () is missingr`   	font.size)g      @g?)figsize皙?g?"   There are 几个汉字 in between!r)   333333?)pngraw)r8  )r7   FontPropertiesr   r8   r   r   skippltrcParamsfiguretextsavefigioBytesIO)r<   	file_namefpfigfmts        r%   test_fallback_smoker  Z  s     
		;-	0BBKKO!!Y.eK=9+\BC "CLL
**\
*CHHT4="K0  2HHT4= M  # BJJL- r'   ))r  z
wqy-zenhei)r  NotoSansCJKr  )r  pdfepssvg)
extensionsc                    [         R                  " U/S9nU[        [         R                  " U5      5      R                  ;  a  [
        R                  " SU SU S35        / SQnS[        R                  S'   SU//S	-  nS/U/S//n[        [        XVU5      5       H7  u  nu  pnUR                  S
SSU-  -
  XS9  U R                  S
SSU-  -
  XS9  M9     g )Nr  r  r  r  )z	There areu   几个汉字zin between!r`   r  r)   rn   r  r  g333333?)r7   r  r   r8   r   r   r  r  r  	enumeratezipr  )fig_testfig_refr<   r  r  r  
test_fonts	ref_fontsjtxt	test_fontref_fonts               r%   test_font_fallback_chineser  o  s     
		;-	0BR[[_-222eK=9+\BC7D "CLL +./!3J;--AI)2),*%%CH 	T3a<>dC$q&L#@	*r'   	font_listzDejaVu SerifzDejaVu Sans Monoz	two fontszone fontc                    [         R                  " 5       nUR                  SSSUS9  UR                  R	                  5         [        S U  5       5      (       d   eU S   R                  R                  S   R                  S5      (       d   e[        U Vs/ s H!  o3U S   R                  R                  S   ;   PM#     sn5      (       d   eg s  snf )Ng      ?u   Hello 🙃 World!r  c              3   V   #    U  H  n[        UR                  [        5      v   M!     g 7fr\  )
isinstancemessageUserWarning)r   warns     r%   r   (test_fallback_missing.<locals>.<genexpr>  s     Iz$,,44r   r   z8Glyph 128579 (\N{UPSIDE-DOWN FACE}) missing from font(s))	r  r  r  canvasdrawallr  args
startswith)recwarnr  r  rX   s       r%   test_fallback_missingr    s    
 **,CHHR(H;JJOOIIIIII1:""1%00FH H H HyIyt
**//22yIJJJJIs   (Cc                 `   [         R                  " U /S9n[        [         R                  " U5      5      R                  nX;  a  [
        R                  " SU  SU S35        Sn[         R                  " [         R                  R                  [         R                  " SU /S95      5      nUR                  U5      nUR                  5        H`  u  px[        U5      S:  a'  [        UR                  5      R                  U:X  d   eM;  [        UR                  5      R                  S:X  a  M`   e   g )	Nr  r  r  r  r  r)      zDejaVuSans.ttf)r7   r  r   r8   r   r   r  get_fontfontManager_find_fonts_by_props_get_fontmapr   r   r:   )	r<   r  r  found_file_namer  ftfontmapcharrX   s	            r%   test__get_fontmapr    s     
		;-	0B2;;r?+00O'eK=9+\BC/D	
++m[%AB	

B
 ood#Gmmo
t9s?

#((O;;;

#((,<<<<	 &r'   ).r   r  pathlibr   numpyr   r   
matplotlibrx  r   matplotlib.testing.decoratorsr   matplotlib.font_managerfont_managerr7   matplotlib.pathpathr  matplotlib.pyplotpyplotr  r&   rZ   rh   rw   r   r   r   r   _expected_sfnt_namesmarkparametrizer   keysr   r^  r_  r  r  r  r  r  r  r  r  r   r'   r%   <module>r     s	    	      = $  -$2D0B.B"3J. VO"h3 +a	D Caqf2	1 1  ));$ '+& 9q9{w t .0D0J0J0L1668  :	:	 
v
J
 !*
 :	

 R
 $
 
 )3O
 E
 "4
 *0
 8>t
 
 Q
  
 
 q
  Cbr!"# $%($%!"

q
T
 S
 #1!
 a	

 t

 &7
  
 %8
  
 (;D
 "1
 '<S
 c
 $8
 A
 A
 I 2%
" t##!A !$
 f!%RqQ
 AAF 
v
F
 !)
 :	

 Q
 $
 v
  *6
 C
  
 (.t
 6<T
 
 Q
  
 
 q
  12a!"# #%($%!"

q
T
 S
 #1!
 a	

 s

 %6s
  
 %8
  
 ':3
 "1
 '<T
 c
 $8
 A
 A
 (,2$
" t#!c!A !#
 f!%RqQ
 $I#C
AOb 
v
F
 !*
 :	

 R
 $
 
 )3O
 A
 t
 &,T
 4:4
 
 Q
  
 
 q
  11a!"# "%&$%!"

q
S
 S
 #1!
 a	

 s

 %6s
  
 %8
  
 ':3
 "1
 '<S
 b
 #7
 A
 A
 * 2%
" t#C!A !"
 f!%RqQ
 AAgU p &;&@&@&BC#8#G#L#L#NOS P DS C F %3%3P.*..3>98 1G
.
.  1F
  <=A >A$ *M:./1):6  8K	8K ==r'   