o
    ¡:´al  ã                   @   s˜   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d„ Z	dd	„ Z
d
d„ Zdd„ Zdd„ Zej dddg¡dd„ ƒZej dddg¡dd„ ƒZdS )é    )Ú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                  C   s(   d} |   d¡}t |¡}|| ksJ ‚d S )Nu   Ð¿Ñ€Ð¸Ð²ÐµÑ‚Úutf8)Úencoder   Z_to_str)Zinp_strZbyte_strÚret© r   ú;/usr/lib/python3/dist-packages/matplotlib/tests/test_afm.pyÚtest_nonascii_str$   s   

r
   c                  C   sD   t tƒ} t | ¡}|ddddddddd	d
ddg d¢ddœks J ‚d S )Ng       @zMyFont-BoldZFontSpecificzMy Font Boldz
Test FontsZBoldg        Fiœÿÿÿg¢E¶óýdL@z001.000s   Copyright © 2017 No one.)r   i¿þÿÿiÒ  iq  é   )s   StartFontMetricss   FontNames   EncodingSchemes   FullNameó
   FamilyNames   Weights   ItalicAngles   IsFixedPitchs   UnderlinePositions   UnderlineThicknesss   Versions   Notices   FontBBoxs   StartCharMetrics)r   ÚAFM_TEST_DATAr   Ú_parse_header)ÚfhÚheaderr   r   r	   Útest_parse_header.   s$   
òr   c                  C   s|   t tƒ} t | ¡ t | ¡}|ddg d¢fddg d¢fddg d	¢fd
œddg d¢fddg d¢fddg d	¢fdœfks<J ‚d S )Ng     @o@Úspace)r   r   r   r   g     Ô‘@Úfoo)é(   é<   i   ih  g     8‚@Úbar)r   iöÿÿÿi  éÒ   )r   é*   éc   )r   r   r   )r   r   r   r   Z_parse_char_metrics)r   Zmetricsr   r   r	   Útest_parse_char_metricsC   s   

þþûr   c                  C   s.   t tƒ} t | ¡}|jd= | ¡ dksJ ‚d S )Nr   zMy Font)r   r   r   ÚAFMZ_headerZget_familyname)r   Úfontr   r   r	   Útest_get_familyname_guessedR   s   
r   c                  C   s0   t  tt dd¡ƒ¡} t d| ¡jdksJ ‚d S )Ns   Weight Bold
s   Weight Custom
Ú Znormal)r   r   r   r   ÚreplaceÚfmZafmFontPropertyZweight)r   r   r   r	   Ú&test_font_manager_weight_normalizationY   s   
ÿ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                 C   sB   t | ƒ}t t¡ t |¡ W d   ƒ d S 1 sw   Y  d S )N)r   ÚpytestZraisesÚRuntimeErrorr   r   )r"   r   r   r   r	   Útest_bad_afm_   s   "ÿr%   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                 C   sT   t | ƒ}| tj¡ t |¡ W d   ƒ n1 sw   Y  t|jƒdks(J ‚d S )Né   )r   Zat_levelÚloggingZERRORr   r   ÚlenZrecords)r"   Zcaplogr   r   r   r	   Útest_malformed_headerq   s
   ÿr)   )Úior   r#   r'   Z
matplotlibr   r   r    r   r
   r   r   r   r!   ZmarkZparametrizer%   r)   r   r   r   r	   Ú<module>   s2    
ýþ
øþ