File: //home/arjun/projects/env/lib/python3.10/site-packages/fontTools/__pycache__/afmLib.cpython-310.pyc
o
wea3 � @ s d Z ddlZe�d�Ze�d�Ze�d�Ze�d�Ze�d�Zg d�ZG d d
� d
e �Z
G dd� de�Zd
d� Z
ddd�Zedkr�ddlZe�� Zer�ee�ZdZe�e�r[eee � dZe�e�rheee � eej� eej� ee�� � ee� e�ed � dS dS dS )a
Module for reading and writing AFM (Adobe Font Metrics) files.
Note that this has been designed to read in AFM files generated by Fontographer
and has not been tested on many other files. In particular, it does not
implement the whole Adobe AFM specification [#f1]_ but, it should read most
"common" AFM files.
Here is an example of using `afmLib` to read, modify and write an AFM file:
>>> from fontTools.afmLib import AFM
>>> f = AFM("Tests/afmLib/data/TestAFM.afm")
>>>
>>> # Accessing a pair gets you the kern value
>>> f[("V","A")]
-60
>>>
>>> # Accessing a glyph name gets you metrics
>>> f["A"]
(65, 668, (8, -25, 660, 666))
>>> # (charnum, width, bounding box)
>>>
>>> # Accessing an attribute gets you metadata
>>> f.FontName
'TestFont-Regular'
>>> f.FamilyName
'TestFont'
>>> f.Weight
'Regular'
>>> f.XHeight
500
>>> f.Ascender
750
>>>
>>> # Attributes and items can also be set
>>> f[("A","V")] = -150 # Tighten kerning
>>> f.FontName = "TestFont Squished"
>>>
>>> # And the font written out again (remove the # in front)
>>> #f.write("testfont-squished.afm")
.. rubric:: Footnotes
.. [#f1] `Adobe Technote 5004 <https://www.adobe.com/content/dam/acom/en/devnet/font/pdfs/5004.AFM_Spec.pdf>`_,
Adobe Font Metrics File Format Specification.
� Nz^([A-Za-z]+).*zl(-?\d+)\s*;\s*WX\s+(-?\d+)\s*;\s*N\s+([.A-Za-z0-9_]+)\s*;\s*B\s+(-?\d+)\s+(-?\d+)\s+(-?\d+)\s+(-?\d+)\s*;\s*z0([.A-Za-z0-9_]+)\s+([.A-Za-z0-9_]+)\s+(-?\d+)\s*z([.A-Za-z0-9_]+)\s+(\d+)\s*;\s*z1PCC\s+([.A-Za-z0-9_]+)\s+(-?\d+)\s+(-?\d+)\s*;\s*)�FontName�FullName�
FamilyName�Weight�ItalicAngle�IsFixedPitch�FontBBox�UnderlinePosition�UnderlineThickness�Version�Notice�EncodingScheme� CapHeight�XHeight�Ascender� Descenderc @ s e Zd ZdS )�errorN)�__name__�
__module__�__qualname__� r r �I/home/arjun/projects/env/lib/python3.10/site-packages/fontTools/afmLib.pyr u s r c @ s� e Zd ZdZg d�Zd.dd�Zdd� Zdd� Zd d
� Zdd� Z d
d� Z
d/dd�Zdd� Zdd� Z
dd� Zdd� Zdd� Zdd� Zdd� Zd d!� Zd"d#� Zd$d%� Zd&d'� Zd(d)� Zd*d+� Zd,d-� ZdS )0�AFMN)
�StartFontMetrics�EndFontMetrics�StartCharMetrics�EndCharMetrics�
StartKernData�StartKernPairs�EndKernPairs�EndKernData�StartComposites�
EndCompositesc C s>