1AFM2PL(1)                           afm2pl                           AFM2PL(1)
2
3
4

NAME

6       afm2pl - convert AFM font metrics to TeX pl font metrics
7

SYNOPSIS

9       afm2pl [-p encoding_file] [-o] [-e extension_factor] [-s slant_factor]
10              [-f font_dimensions] [-k] [-m letter_spacing] [-l ligkern_spec]
11              [-L ligkern_spec] [-n] input_file[.afm] [output_file[.pl]]
12
13       afm2pl [--help] | [--version]
14

DESCRIPTION

16       afm2pl converts an afm (Adobe Font Metric) file into a pl (Property
17       List) file, which in its turn can be converted to a tfm (TeX Font
18       Metric) file. It normally preserves kerns and ligatures, but also
19       offers additional control over them.
20
21       afm2pl is meant to be a partial replacement for afm2tfm, on which it is
22       based. With afm2tfm, preserving kerns and ligatures is possible only in
23       a roundabout way, and handling of them is hard-wired.
24
25       For text fonts, Y&Y´s texnansi is a good encoding to be used with
26       afm2pl. Its character set includes all the accented characters likely
27       to be needed for Western languages, plus many typographic symbols,
28       without a need for either virtual fonts or a separate text companion
29       font.
30
31       Full LaTeX support for this encoding is available in the form of the
32       texnansi package, which is already part of TeX Live and teTeX. These
33       distributions also contain the encoding file texnansi.enc.
34
35       The distribution contains uppercased and lowercased versions of
36       texnansi, viz. texnanuc and texnanlc, to allow font-based rather than
37       macro-based uppercasing and lowercasing, and the familiar old ot1
38       encoding plus some variations in PostScript .enc format (I included
39       these because they seem to be absent from teTeX/TeX Live). However,
40       check your mapfiles if you have old afm2pl-generated fonts using these.
41
42       Return value: 0 if no error; a negative number indicating the number of
43       missing glyphs if conversion was otherwise successfull but glyphs are
44       missing, and 1 in case of error.
45

OPTIONS

47       -p encoding_file
48           The default is the encoding specified in the afm file, which had
49           better match the encoding in the fontfile (pfa or pfb). If
50           afm2pl-name.enc exists, afm2pl will use this file instead of
51           name.enc, unless an option -n is given. The generated mapfile entry
52           (see below) instructs pdftex or the dvi driver to reencode the font
53           on the fly. On-the-fly reencoding does not require virtual fonts.
54
55       -o
56           Use octal for all character codes in the pl file.
57
58       -e extend_factor
59           Widen or narrow characters by extend_factor. Default is 1.0
60           (natural width). Not recommended[1].
61
62       -s slant_factor
63           Oblique (slant) characters by slant_factor. Not recommended either.
64
65       -f font_dimensions
66           The value is either the keyword afm2tfm or a comma-separated list
67           of up to five integers. The parameters are listed below, with their
68           defaults and their value when the afm2tfm keyword is specified.
69           ‘Space’ means the width of a space in the target font, except of
70           course in the last row. Keep in mind that the design size is 1000,
71           and that all numbers must be nonnegative integers.
72
73           ┌───────────────┬─────────────────────┬─────────────────────┐
74Font dimension Default value       Afm2tfm value       
75           ├───────────────┼─────────────────────┼─────────────────────┤
76stretch        │ space div 2         │ 300 × extend_factor
77           ├───────────────┼─────────────────────┼─────────────────────┤
78shrink         │ space div 3         │ 100 × extend_factor
79           ├───────────────┼─────────────────────┼─────────────────────┤
80extra space    │ space div 3         │ missing             │
81           ├───────────────┼─────────────────────┼─────────────────────┤
82quad           │ 2 × width of ‘0’    │ 1000 ×              │
83           │               │                     │ extend_factor
84           ├───────────────┼─────────────────────┼─────────────────────┤
85space          │ (space source font) │ (space source font) │
86           │               │ × extend_factor     │ × extend_factor
87           └───────────────┴─────────────────────┴─────────────────────┘
88           For fixed-pitch fonts, different values apply:
89
90           ┌───────────────┬─────────────────────┬─────────────────┐
91Font dimension Default value       Afm2tfm value   
92           ├───────────────┼─────────────────────┼─────────────────┤
93stretch        │ 0                   │ 0               │
94           ├───────────────┼─────────────────────┼─────────────────┤
95shrink         │ 0                   │ 0               │
96           ├───────────────┼─────────────────────┼─────────────────┤
97extra space    │ space               │ missing         │
98           ├───────────────┼─────────────────────┼─────────────────┤
99quad           │ 2 × character width │ 1000 ×          │
100           │               │                     │ extend_factor
101           ├───────────────┼─────────────────────┼─────────────────┤
102space          │ character width     │ character width │
103           └───────────────┴─────────────────────┴─────────────────┘
104           Specify just a non-default stretch and shrink with e.g.  150,70 and
105           just a non-default extra space with ,,10.
106
107       -k
108           Keep original ligatures. This option only has effect in combination
109           with positive letterspacing; see the section on letterspacing and
110           extra ligkern info.
111
112       -m letter_spacing
113           Letterspace by letter_spacing/1000 em (integer). This is useful for
114           making all-caps typesetting look better. Try a value of e.g. 50 or
115           100. But see the section on letterspacing and extra ligkern info
116           for details. A better alternative, though, is letting pdftex do the
117           letterspacing. The microtype package gives LaTeX users access to
118           this feature.
119
120       -l ligkern_spec, -L ligkern_spec
121           See the section on extra ligkern info for details.
122
123       -n
124           No prefix. For .enc- and .lig files, the program normally first
125           prefixes the name with `afm2pl-´. Only if the prefixed filename is
126           not found, will it search for the original filename. This option
127           prevents searching for the prefixed filename.
128
129       -V
130           Verbose. If turned on, it reports the number of missing glyphs to
131           stderr and their names to stdout.
132
133       --help
134           Display a short usage message.
135
136       --version
137           Display the version number of afm2pl.
138

MAPFILE ENTRIES

140       afm2pl writes a mapfile entry to a file with the same basename as the
141       pl output file, but with extension .map. It can be used for the dvips
142       mapfile and for the pdftex mapfile. It is assumed that the pfb file has
143       the same basename as the afm file and must be downloaded.  You may have
144       to hand-edit this entry.
145
146       You can configure dvips and pdftex to read this additional mapfile or
147       otherwise add the entry to an existing mapfile.
148
149       Check your mapfiles!  To reduce the likelihood of name conflicts, the
150       .enc- files which are part of afm2pl (ot1, ot1csc, ot1ital, ot1tt,
151       texnanlc and texnanuc) have now been prepended with afm2pl-. The .enc
152       files are referenced in mapfiles. If you have old afm2pl-generated .tfm
153       files using these, then you should update their mapfile fragments and
154       rerun updmap or updmap-sys. Or you can copy the relevant enc files to
155       your personal or local texmf tree under their previous non-prefixed
156       names.
157

EXTRA LIGKERN INFO

159       Most users are well-advised to leave this mess alone and to accept the
160       default behavior.
161
162       The ligatures and kerns present in the afm file can be modified in
163       various ways. Default, the encoding file is scanned for extra ligkern
164       specifications, whose format will be described below. If there are no
165       ligkern specifications in the encoding file, then extra ligkern
166       specifications will be read from a file [afm2pl-]default.lig. A value
167       of 0 for ligkern_spec means that the ligatures and kerns from the afm
168       file won´t be tampered with and a value of 1 specifies default
169       behavior. One can also specify a comma-separated list of files with
170       extra ligkerns specs.
171
172       If afm2pl is compiled with the kpathsea library, then these files will
173       be searched for under $TEXMF/fonts/lig.
174
175       Note that ligatures and kerns are hints for the typesetting
176       application; there is no need to download this information to the
177       printer or to make it available to a dvi driver.
178
179       The parser for ligkern info has been inherited from afm2tfm virtually
180       without change. A ligkern specification can have one of the following
181       forms:
182
183           glyph_name1 glyph_name2 lig_op glyph_name3 ;
184
185       This specifies a ligature. Possible values for lig_op are =:, |=:,
186       |=:>, =:|, =:|>, |=:|, |=:|> and |=:|>>. These correspond to LIG, /LIG,
187       /LIG>, LIG/, LIG/>, /LIG/, /LIG/>, /LIG/>> in .pl syntax; see the
188       pltotf documentation and the .lig files in the distribution.
189
190           glyph_name1 <> glyph_name2 ;
191
192       Kern glyph_name1 as glyph_name2.
193
194           glyph_name1 {} glyph_name2 ;
195
196       Remove the kern between glyph_name1 and glyph_name2. A value of * for
197       either glyph name is interpreted as a wildcard.
198
199           || = glyph ;
200
201       Set the (right) boundary character to glyph.  glyph may be either a
202       glyphname or a slot in the encoding vector. Choosing a glyph which
203       doesn´t occur in the output encoding is equivalent to not specifying a
204       boundarychar at all. It is ok to pick an encoded glyphname which does
205       not occur in the afm. In fact, this is what default.lig does: || = cwm
206       ;.
207
208       You can copy the kerns of an unencoded character to the boundarychar.
209       Below, space is the unencoded character:
210
211           || <> space ;
212
213       This ligkern specification should occur before the one that deletes
214       space kerns.
215
216       A ligkern specification should be contained within one line. One line
217       may contain several ligkern specifications, separated by spaces. Note
218       that ; (space followed by semicolon) is considered part of the ligkern
219       specification. See the lig files included in this distribution.
220       Example:
221
222           one {} * ; * {} one ; two {} * ; * {} two ;
223
224       Lines with ligkern specifications inside an encoding file should start
225       with % LIGKERN. Ligkern specifications in a lig file may optionally
226       start this way.
227

LETTERSPACING AND EXTRA LIGKERN INFO

229       Letterspacing has various side-effects for ligkern info. Instead of
230       simply applying the extra ligkern info (see previous section), the
231       following is done:
232
233
234       1.     In case of positive letterspacing, native ligatures are removed,
235              unless the -k option is specified.
236
237
238       2.     Extra ligkern info is applied as usual, except that in case of
239              positive letterspacing different defaults apply: -l 0 is quietly
240              ignored, ligkern comments in the encoding file are ignored, and
241              defpre.lig is read instead of default.lig.
242
243
244       3.     Letterspacing is applied. This adds a lot of kerns, and modifies
245              existing kerns.
246
247
248       4.     The extra ligkern info specified with -L is applied. The only
249              ligkern specs which are allowed here, are removals of kerning
250              pairs (with the {} operator). Values 0 and 1 have a similar
251              meaning as for the -l parameter.  The tfm format has room for
252              only about 180x180 ligatures and kerning pairs.  This is enough
253              for OT1 encoding, but for texnansi encoding quite a few ligkern
254              specifications have to be removed. The pltotf program will
255              remove all ligkern info if too many ligatures and kerns remain.
256              The default lig file is defpost.lig. This file throws out
257              kerning pairs which are unlikely to be involved in
258              letterspacing, such as kerns involving accents or kerns with a
259              punctuation character or right bracket at the left. It does not
260              add letterspacing kerns involving boundarychars. Instead,
261              fontspace is increased by twice the letterspacing. defpost.lig
262              throws out enough kerns in case of texnansi encoding. With other
263              encodings, you may have to throw out additional kerning pairs.
264
265

FONT-BASED UPPER- AND LOWERCASING

267       The distribution includes encoding vectors texnanuc.enc and
268       texnanlc.enc which produce all-uppercase and all-lowercase fonts
269
270       The principal uses for an all-uppercase font are page headers and
271       section heads. If these contain math, then macro-based uppercasing
272       would create unpleasant complications. Example:
273
274           afm2pl -p texnanuc ptmr8a ptmup8y
275           pltotf ptmup8y
276
277       For best results, you should add some letterspacing. In LaTeX, this is
278       best done with the microtype package; see the documentation of that
279       package. But it can also be done with afm2pl:
280
281           afm2pl -p texnanuc -m 100 ptmr8a ptmup8y
282
283       This requires caution; see above.
284
285       You can use this new font within the context of LaTeX font selection as
286       follows:
287
288
289           <preamble commands>
290           \makeatletter
291           {\nfss@catcodes
292           \DeclareFontShape{LY1}{ptm}{m}{upp}{<-> ptmup8y}{}}
293           \makeatother
294           ...
295           \begin{document}
296           ...
297           {\fontshape{upp}\selectfont uppercase text}
298
299
300       Note that upp is simply a newly made-up shape name.
301
302   The sz ligature ß
303       Note that the texnanuc encoding provides no glyph for the sz ligature
304       ß; you´ll either have to substitute ss or provide a macro-based
305       solution. The following code uses either the usual glyph or substitutes
306       the letters ss, depending on whether the glyph exists in the current
307       font:
308
309
310           \def\ss{%
311             \setbox0\hbox{\char25}%
312             \ifnum\wd0=0 ss\else\box0\fi
313           }
314
315
316       In LaTeX, this code appears to work well enough, although on occasion
317       you may need to insert \protect. A better solution might involve the
318       sixth parameter of the \DeclareFontShape macro, but I failed to get
319       that to work.
320

AFM2PL, FONTINST AND ARTIFICIAL SMALLCAPS

322       Afm2pl doesn´t do virtual fonts. That means that for things such as
323       artificial smallcaps you have to turn elsewhere, e.g. to the fontinst
324       package, which is part of any mainstream TeX distribution.
325
326       Look under texmf/tex/fontinst for fontinst support files, which allow
327       you to generate a smallcaps font (tfm and vf files) from an
328       afm2pl-generated tfm file. This package only supports texnansi
329       encoding.
330
331       There should be no real problem in doing the same for OT1 encoding.
332       However, there are several variations of the OT1 encoding to take care
333       of. Also, there are as far as I know no officially sanctioned
334       PostScript names for all the variations of the OT1 encoding; the
335       fontinst names contain spaces and are therefore not useable as
336       PostScript names.
337

CHANGED IN VERSION 0.7.1

339       In order to avoid name conflicts, the .enc- and .lig files distributed
340       with afm2pl got afm2pl- prepended to their name. The program itself now
341       first searches for the thus prepended name. If the .enc- or .lig file
342       is not found it will look for the original filename. The renaming of
343       the afm2pl .enc files may require modification of some mapfiles.
344

URLS

346       The afm2pl homepage is http://tex.aanhet.net/afm2pl/.
347
348       The paper Font installation the shallow way[2] (EuroTeX 2006
349       Proceedings, published as TUGboat[3] issue 27.1) illustrates the use of
350       afm2pl.
351

NOTES

353        1. Except that arguably a narrowed Courier is less jarring than a
354           full-width Courier, when used in combination with a normal
355           proportional font. For Courier, choose .833 to match the width of
356           cmtt. Better yet, don't use Courier at all; most TeX distributions
357           offer various good replacements.
358
359        2. Font installation the shallow way
360           http://www.tug.org/TUGboat/Articles/tb27-1/tb86kroonenberg-fonts.pdf
361
362        3. TUGboat
363           http://www.tug.org/TUGboat/
364
365
366
367                                   May 2009                          AFM2PL(1)
Impressum