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