
    ^j                         d dl mZ d dlZd dlZd dlmZ d dlmZ dZd Z	d Z
d Zd	 Zd
 Zej                  j                  dddg      d        Zej                  j                  dddg      d        Zd Zy)    )BytesION)_afm)font_managers  StartFontMetrics 2.0
Comment Comments are ignored.
Comment Creation Date:Mon Nov 13 12:34:11 GMT 2017
FontName MyFont-Bold
EncodingScheme FontSpecific
FullName My Font Bold
FamilyName Test Fonts
Weight Bold
ItalicAngle 0.0
IsFixedPitch false
UnderlinePosition -100
UnderlineThickness 56,789
Version 001.000
Notice Copyright  2017 No one.
FontBBox 0 -321 1234 369
StartCharMetrics 3
C 0 ; WX 250 ; N space ; B 0 0 0 0 ;
C 42 ; WX 1141 ; N foo ; B 40 60 800 360 ;
C 99 ; WX 583 ; N bar ; B 40 -10 543 210 ;
EndCharMetrics
EndFontMetrics
c                  b    d} | j                  d      }t        j                  |      }|| k(  sJ y )Nu   приветutf8)encoder   _to_str)inp_strbyte_strrets      d/var/www/ramen.bs-engineer-server.com/venv/lib/python3.12/site-packages/matplotlib/tests/test_afm.pytest_nonascii_strr   $   s1     G~~f%H
,,x
 C'>>    c                  |    t        t              } t        j                  |       }|ddddddddd	d
ddg dddk(  sJ y )Ng       @zMyFont-BoldFontSpecificzMy Font Boldz
Test FontsBoldg        FigEdL@z001.000s   Copyright  2017 No one.)r   ii  iq     )StartFontMetricsFontNameEncodingSchemeFullName
FamilyNameWeightItalicAngleIsFixedPitchUnderlinePositionUnderlineThicknessVersionNoticeFontBBoxStartCharMetrics)r   AFM_TEST_DATAr   _parse_header)fhheaders     r   test_parse_headerr&   .   s]    		B#F!(""!$0(   r   c            	         t        t              } t        j                  |        t        j                  |       }|t        j
                  ddd      t        j
                  ddd      t        j
                  ddd	      d
t        j
                  ddd      t        j
                  ddd      t        j
                  ddd	      dfk(  sJ y )Ng     @o@space)r   r   r   r   g     ԑ@foo)(   <   i   ih  g     8@bar)r*   ii     )r   *   c   )r(   r)   r,   )r   r"   r   r#   _parse_char_metricsCharMetrics)r$   metricss     r   test_parse_char_metricsr3   C   s    		Br&&r*Gw=  0BC  /BC	
 %%eWlC##FE3EF##E52EF	
   r   c                      t        t              } t        j                  |       }|j                  d= |j                         dk(  sJ y )Nr   zMy Font)r   r"   r   AFM_headerget_familyname)r$   fonts     r   test_get_familyname_guessedr9   U   s<    		B88B<D\" I---r   c                      t        j                  t        t        j	                  dd                  } t        j                  d|       j                  dk(  sJ y )Ns   Weight Bold
s   Weight Custom
 normal)r   r5   r   r"   replacefmafmFontPropertyweight)r8   s    r   &test_font_manager_weight_normalizationrA   \   sL    88G.0BCE FDb$'..(:::r   afm_datas   nope
really nopes   StartFontMetrics 2.0
Comment Comments are ignored.
Comment Creation Date:Mon Nov 13 12:34:11 GMT 2017
FontName MyFont-Bold
EncodingScheme FontSpecificc                     t        |       }t        j                  t              5  t	        j
                  |       d d d        y # 1 sw Y   y xY w)N)r   pytestraisesRuntimeErrorr   r#   )rB   r$   s     r   test_bad_afmrG   b   s=     
	B	|	$ 2  s   AAs   StartFontMetrics 2.0
Comment Comments are ignored.
Comment Creation Date:Mon Nov 13 12:34:11 GMT 2017
Aardvark bob
FontName MyFont-Bold
EncodingScheme FontSpecific
StartCharMetrics 3s   StartFontMetrics 2.0
Comment Comments are ignored.
Comment Creation Date:Mon Nov 13 12:34:11 GMT 2017
ItalicAngle zero degrees
FontName MyFont-Bold
EncodingScheme FontSpecific
StartCharMetrics 3c                     t        |       }|j                  t        j                        5  t	        j
                  |       d d d        t        |j                        dk(  sJ y # 1 sw Y   $xY w)N   )r   at_levelloggingERRORr   r#   lenrecords)rB   caplogr$   s      r   test_malformed_headerrP   t   sZ    ( 
	B		' 2 v~~!### s   A$$A-c                      t        j                  dd      } t        | d      5 }t        j                  |      }d d d        j                  dd      dk(  sJ |j                  dd      dk(  sJ y # 1 sw Y   8xY w)	N	Helveticaafm)fontextrbAVg     Qg      T)r>   findfontopenr   r5   get_kern_dist_from_name)fnr$   rS   s      r   test_afm_kerningr\      su    	[%	0B	b$ 2hhrl&&sC0E999&&sC0E999 s   A11A:)ior   rD   rK   
matplotlibr   r   r>   r"   r   r&   r3   r9   rA   markparametrizerG   rP   r\    r   r   <module>rb      s        )0*$.; 		 		&$'&$:r   