Warning: session_start(): Session cannot be started after headers have already been sent in /home/tvrreohg/public_html/manga.php on line 13
3
2øªji+ ã @ s* d Z ddlZejdƒZejdƒZejdƒZejdƒZejdƒZdd d
ddd
ddddddddddgZG dd„ de ƒZ
G dd„ deƒZdd„ Z
d%dd „Zed!k�r&ddlZejƒ Ze�r&eeƒZd"ZejeƒrÖeee ƒ d&Zejeƒrðeee ƒ eejƒ eejƒ eejƒ ƒ eeƒ ejed$ ƒ 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 `_,
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*ZFontNameÚFullNameZ
FamilyNameÚWeightZItalicAngleZIsFixedPitchÚFontBBoxZUnderlinePositionZUnderlineThicknessÚVersionZNoticeZEncodingSchemeZ CapHeightZXHeightZAscenderZ Descenderc @ s e Zd ZdS )ÚerrorN)Ú__name__Ú
__module__Ú__qualname__© r
r
ú5/tmp/pip-build-_d5lkt3n/fonttools/fontTools/afmLib.pyr x s r c
@ sÔ e Zd ZdZdddddddd d
dg
Zd7dd
„Zdd„ Zdd„ Zdd„ Zdd„ Z dd„ Z
d8dd„Zdd„ Zdd„ Z
dd „ Zd!d"„ Zd#d$„ Zd%d&„ Zd'd(„ Zd)d*„ Zd+d,„ Zd-d.„ Zd/d0„ Zd1d2„ Zd3d4„ Zd5d6„ ZdS )9ÚAFMNZStartFontMetricsÚEndFontMetricsZStartCharMetricsÚEndCharMetricsÚ
StartKernDataZStartKernPairsÚEndKernPairsÚEndKernDataZStartCompositesÚ
EndCompositesc C s: i | _ i | _i | _i | _g | _i | _|dk r6| j|ƒ dS )záAFM file reader.
Instantiating an object with a path name will cause the file to be opened,
read, and parsed. Alternatively the path can be left unspecified, and a
file can be parsed later with the :meth:`read` method.N)Ú_attrsÚ_charsÚ_kerningÚ_indexÚ _commentsÚ_compositesÚread)ÚselfÚpathr
r
r Ú__init__Œ s zAFM.__init__c C sÄ t |ƒ}x¶|D ]®}|jƒ sqtj|ƒ}|dkr>tdt|ƒ ƒ‚|jd d }|d|… }||d… jƒ }|| jkrtq|dkrˆ| j|ƒ q|dkrœ| j |ƒ q|dkr°| j
|ƒ q| j||ƒ qW dS )zOpens, reads and parses a file.Nzsyntax error in AFM file: é ÚCZKPXÚCC)Ú readlinesÚstripÚidentifierREÚmatchr ÚreprÚregsÚ _keywordsÚ parsecharÚ
parsekernpairÚparsecompositeÚ parseattr)r r ÚlinesÚlineÚmÚposÚwordÚrestr
r
r r › s&