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

MAPFILE ENTRIES

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

EXTRA LIGKERN INFO

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

LETTERSPACING AND EXTRA LIGKERN INFO

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

FONT-BASED UPPER- AND LOWERCASING

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

AFM2PL, FONTINST AND ARTIFICIAL SMALLCAPS

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

CHANGED IN VERSION 0.7.1

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

URLS

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

NOTES

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