1AFM(3) User Contributed Perl Documentation AFM(3)
2
3
4
6 Font::AFM - Interface to Adobe Font Metrics files
7
9 use Font::AFM;
10 $h = new Font::AFM "Helvetica";
11 $copyright = $h->Notice;
12 $w = $h->Wx->{"aring"};
13 $w = $h->stringwidth("Gisle", 10);
14 $h->dump; # for debugging
15
17 This module implements the Font::AFM class. Objects of this class are
18 initialised from an AFM (Adobe Font Metrics) file and allow you to
19 obtain information about the font and the metrics of the various glyphs
20 in the font.
21
22 All measurements in AFM files are given in terms of units equal to
23 1/1000 of the scale factor of the font being used. To compute actual
24 sizes in a document, these amounts should be multiplied by (scale
25 factor of font)/1000.
26
27 The following methods are available:
28
29 $afm = Font::AFM->new($fontname)
30 Object constructor. Takes the name of the font as argument. Croaks
31 if the font can not be found.
32
33 $afm->latin1_wx_table()
34 Returns a 256-element array, where each element contains the width
35 of the corresponding character in the iso-8859-1 character set.
36
37 $afm->stringwidth($string, [$fontsize])
38 Returns the width of the argument string. The string is assumed to
39 be encoded in the iso-8859-1 character set. A second argument can
40 be used to scale the width according to the font size.
41
42 $afm->FontName
43 The name of the font as presented to the PostScript language
44 "findfont" operator, for instance "Times-Roman".
45
46 $afm->FullName
47 Unique, human-readable name for an individual font, for instance
48 "Times Roman".
49
50 $afm->FamilyName
51 Human-readable name for a group of fonts that are stylistic variants
52 of a single design. All fonts that are members of such a group
53 should have exactly the same "FamilyName". Example of a family name
54 is "Times".
55
56 $afm->Weight
57 Human-readable name for the weight, or "boldness", attribute of a
58 font. Examples are "Roman", "Bold", "Light".
59
60 $afm->ItalicAngle
61 Angle in degrees counterclockwise from the vertical of the dominant
62 vertical strokes of the font.
63
64 $afm->IsFixedPitch
65 If "true", the font is a fixed-pitch (monospaced) font.
66
67 $afm->FontBBox
68 A string of four numbers giving the lower-left x, lower-left y,
69 upper-right x, and upper-right y of the font bounding box. The font
70 bounding box is the smallest rectangle enclosing the shape that
71 would result if all the characters of the font were placed with
72 their origins coincident, and then painted.
73
74 $afm->UnderlinePosition
75 Recommended distance from the baseline for positioning underline
76 strokes. This number is the y coordinate of the center of the
77 stroke.
78
79 $afm->UnderlineThickness
80 Recommended stroke width for underlining.
81
82 $afm->Version
83 Version number of the font.
84
85 $afm->Notice
86 Trademark or copyright notice, if applicable.
87
88 $afm->Comment
89 Comments found in the AFM file.
90
91 $afm->EncodingScheme
92 The name of the standard encoding scheme for the font. Most Adobe
93 fonts use the "AdobeStandardEncoding". Special fonts might state
94 "FontSpecific".
95
96 $afm->CapHeight
97 Usually the y-value of the top of the capital H.
98
99 $afm->XHeight
100 Typically the y-value of the top of the lowercase x.
101
102 $afm->Ascender
103 Typically the y-value of the top of the lowercase d.
104
105 $afm->Descender
106 Typically the y-value of the bottom of the lowercase p.
107
108 $afm->Wx
109 Returns a hash table that maps from glyph names to the width of that
110 glyph.
111
112 $afm->BBox
113 Returns a hash table that maps from glyph names to bounding box
114 information. The bounding box consist of four numbers: llx, lly,
115 urx, ury.
116
117 $afm->dump
118 Dumps the content of the Font::AFM object to STDOUT. Might
119 sometimes be useful for debugging.
120
121 The AFM specification can be found at:
122
123 http://partners.adobe.com/asn/developer/pdfs/tn/5004.AFM_Spec.pdf
124
126 METRICS Contains the path to search for AFM-files. Format is as for
127 the PATH environment variable. The default path built into
128 this library is:
129
130 /usr/lib/afm:/usr/local/lib/afm:/usr/openwin/lib/fonts/afm/:.
131
133 Kerning data and composite character data are not yet parsed. Ligature
134 data is not parsed.
135
137 Copyright 1995-1998 Gisle Aas. All rights reserved.
138
139 This program is free software; you can redistribute it and/or modify it
140 under the same terms as Perl itself.
141
142
143
144perl v5.30.1 2020-01-30 AFM(3)