Debian Codegraph @

texk/afm2pl/afm2pl.xml

raw symbols SCIP
1 <?xml version='1.0' standalone="no"?>
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
3 "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
4 <!ENTITY szlig "&#x00DF;">
5 ]>
6 <refentry>
7 <refentryinfo>
8 <title>afm2pl</title>
9 <date>May 2009</date>
10 </refentryinfo>
11
12 <refmeta>
13 <refentrytitle>afm2pl</refentrytitle>
14 <manvolnum>1</manvolnum>
15 </refmeta>
16
17 <refnamediv>
18 <refname>afm2pl</refname>
19 <refpurpose>convert AFM font metrics to TeX pl font metrics
20 </refpurpose>
21 </refnamediv>
22
23 <refsynopsisdiv>
24 <cmdsynopsis>
25 <command>afm2pl</command>
26 <arg choice="opt"><option>-p</option>
27 <replaceable>encoding_file</replaceable>
28 </arg>
29 <arg choice="opt"><option>-o</option></arg>
30 <arg choice="opt"><option>-e</option>
31 <replaceable>extension_factor</replaceable>
32 </arg>
33 <arg choice="opt"><option>-s</option>
34 <replaceable>slant_factor</replaceable>
35 </arg>
36 <arg choice="opt"><option>-f</option>
37 <replaceable>font_dimensions</replaceable>
38 </arg>
39 <arg choice="opt"><option>-k</option></arg>
40 <arg choice="opt"><option>-m</option>
41 <replaceable>letter_spacing</replaceable>
42 </arg>
43 <arg choice="opt"><option>-l</option>
44 <replaceable>ligkern_spec</replaceable>
45 </arg>
46 <arg choice="opt"><option>-L</option>
47 <replaceable>ligkern_spec</replaceable>
48 </arg>
49 <arg choice="opt"><option>-n</option></arg>
50 <arg choice="req"><replaceable>input_file[.afm]</replaceable></arg>
51 <arg choice="opt"><replaceable>output_file[.pl]</replaceable></arg>
52 </cmdsynopsis>
53
54 <cmdsynopsis>
55 <command>afm2pl</command>
56 <group choice="req">
57 <arg>--help</arg>
58 <arg>--version</arg>
59 </group>
60 </cmdsynopsis>
61 </refsynopsisdiv>
62
63 <refsect1>
64 <title>Description</title>
65 <para>afm2pl converts an afm (Adobe Font Metric) file into a pl
66 (Property List) file, which in its turn can be converted to a tfm
67 (TeX Font Metric) file. It normally preserves kerns and ligatures,
68 but also offers additional control over them.</para>
69
70 <para>afm2pl is meant to be a partial replacement for afm2tfm, on
71 which it is based. With afm2tfm, preserving kerns and ligatures is
72 possible only in a roundabout way, and handling of them is
73 hard-wired.</para>
74
75 <para>For text fonts, Y&amp;Y's texnansi is a good encoding to be
76 used with afm2pl. Its character set includes all the accented
77 characters likely to be needed for Western languages, plus many
78 typographic symbols, without a need for either virtual fonts or a
79 separate text companion font.</para>
80
81 <para>Full LaTeX support for this encoding is available in the form
82 of the texnansi package, which is already part of TeX Live and
83 teTeX. These distributions also contain the encoding file
84 texnansi.enc.</para>
85
86 <para>The distribution contains uppercased and lowercased versions
87 of texnansi, viz. texnanuc and texnanlc, to allow font-based rather
88 than macro-based uppercasing and lowercasing, and the familiar old
89 ot1 encoding plus some variations in PostScript .enc format (I
90 included these because they seem to be absent from teTeX/TeX
91 Live). However, <link linkend="mapwarn">check your mapfiles</link>
92 if you have old afm2pl-generated fonts using these.</para>
93
94 <para>Return value: 0 if no error; a negative number indicating the
95 number of missing glyphs if conversion was otherwise successfull but
96 glyphs are missing, and 1 in case of error.</para>
97 </refsect1>
98
99 <refsect1>
100 <title>Options</title>
101 <variablelist>
102 <varlistentry>
103 <term><option>-p</option> <replaceable>encoding_file</replaceable></term>
104 <listitem>
105 <para>The default is the encoding specified in the afm file,
106 which had better match the encoding in the fontfile (pfa or
107 pfb). If <literal>afm2pl-name.enc</literal> exists, afm2pl will
108 use this file instead of <literal>name.enc</literal>, unless an
109 option <literal>-n</literal> is given. The generated mapfile
110 entry (see below) instructs pdftex or the dvi driver to
111 reencode the font on the fly. On-the-fly reencoding does not
112 require virtual fonts.</para>
113 </listitem>
114 </varlistentry>
115
116 <varlistentry>
117 <term><option>-o</option></term>
118 <listitem>
119 <para>Use octal for all character codes in the pl file.</para>
120 </listitem>
121 </varlistentry>
122
123 <varlistentry>
124 <term><option>-e</option> <replaceable>extend_factor</replaceable></term>
125 <listitem>
126 <para>Widen or narrow characters by
127 <replaceable>extend_factor</replaceable>. Default is 1.0
128 (natural width). Not recommended<footnote><para>Except that arguably a
129 narrowed Courier is less jarring than a full-width Courier,
130 when used in combination with a normal proportional font. For
131 Courier, choose .833 to match the width of cmtt. Better yet,
132 don't use Courier at all; most TeX distributions offer various
133 good replacements.</para></footnote>.</para>
134 </listitem>
135 </varlistentry>
136
137 <varlistentry>
138 <term><option>-s</option> <replaceable>slant_factor</replaceable></term>
139 <listitem>
140 <para>Oblique (slant) characters by
141 <replaceable>slant_factor</replaceable>.
142 Not recommended either.</para>
143 </listitem>
144 </varlistentry>
145
146 <varlistentry>
147 <term><option>-f</option>
148 <replaceable>font_dimensions</replaceable></term> <listitem>
149 <para>The value is either the
150 keyword <literal>afm2tfm</literal> or a comma-separated list of up
151 to five integers. The parameters are listed below, with their
152 defaults and their value when the afm2tfm keyword is
153 specified. &lsquo;Space&rsquo; means the width of a space in the
154 target font, except of course in the last row.
155 Keep in mind that the design size is 1000, and that all numbers
156 must be nonnegative integers.</para>
157
158 <informaltable>
159 <tgroup cols='3'>
160 <colspec colwidth='*'/>
161 <colspec colwidth='2*'/>
162 <colspec colwidth='2*'/>
163 <thead>
164 <row>
165 <entry>Font dimension</entry>
166 <entry>Default value</entry>
167 <entry>Afm2tfm value</entry></row></thead>
168 <tbody>
169
170 <row>
171 <entry><replaceable>stretch</replaceable></entry>
172 <entry>space div 2</entry>
173 <entry>300 &times; <replaceable>extend_factor</replaceable></entry>
174 </row>
175
176 <row>
177 <entry><replaceable>shrink</replaceable></entry>
178 <entry>space div 3</entry>
179 <entry>100 &times; <replaceable>extend_factor</replaceable></entry>
180 </row>
181
182 <row>
183 <entry><replaceable>extra space</replaceable></entry>
184 <entry>space div 3</entry>
185 <entry>missing</entry>
186 </row>
187
188 <row>
189 <entry><replaceable>quad</replaceable></entry>
190 <entry>2 &times; width of &lsquo;0&rsquo;</entry>
191 <entry>1000 &times; <replaceable>extend_factor</replaceable></entry>
192 </row>
193
194 <row>
195 <entry><replaceable>space</replaceable></entry>
196 <entry>(space source font) &times; <replaceable>extend_factor</replaceable></entry>
197 <entry>(space source font) &times; <replaceable>extend_factor</replaceable></entry>
198 </row>
199
200 </tbody></tgroup></informaltable>
201
202 <para>For fixed-pitch fonts, different values apply:</para>
203
204 <informaltable>
205 <tgroup cols='3'>
206 <colspec colwidth='*'/>
207 <colspec colwidth='2*'/>
208 <colspec colwidth='2*'/>
209 <thead>
210 <row>
211 <entry>Font dimension</entry>
212 <entry>Default value</entry>
213 <entry>Afm2tfm value</entry></row></thead>
214 <tbody>
215
216 <row>
217 <entry><replaceable>stretch</replaceable></entry>
218 <entry>0</entry>
219 <entry>0</entry>
220 </row>
221
222 <row>
223 <entry><replaceable>shrink</replaceable></entry>
224 <entry>0</entry>
225 <entry>0</entry>
226 </row>
227
228 <row>
229 <entry><replaceable>extra space</replaceable></entry>
230 <entry>space</entry>
231 <entry>missing</entry>
232 </row>
233
234 <row>
235 <entry><replaceable>quad</replaceable></entry>
236 <entry>2 &times; character width</entry>
237 <entry>1000 &times; <replaceable>extend_factor</replaceable></entry>
238 </row>
239
240 <row>
241 <entry><replaceable>space</replaceable></entry>
242 <entry>character width</entry>
243 <entry>character width</entry>
244 </row>
245
246 </tbody></tgroup></informaltable>
247
248 <para>Specify just a non-default stretch and shrink with
249 e.g. <literal>150,70</literal> and just a non-default extra
250 space with <literal>,,10</literal>.</para>
251
252 </listitem> </varlistentry>
253
254 <varlistentry>
255 <term><option>-k</option></term>
256 <listitem>
257 <para>Keep original ligatures. This option only has effect in
258 combination with positive letterspacing; see the section on
259 <link linkend="lspace">letterspacing and extra ligkern info.</link>
260 </para>
261 </listitem>
262 </varlistentry>
263
264 <varlistentry>
265 <term><option>-m</option> <replaceable>letter_spacing</replaceable></term>
266 <listitem>
267 <para>Letterspace by
268 <replaceable>letter_spacing</replaceable>/1000 em
269 (integer). This is useful for making all-caps typesetting look
270 better. Try a value of e.g. 50 or 100. But see the section
271 on <link linkend="lspace">letterspacing and extra ligkern
272 info</link> for details. A better alternative, though, is
273 letting pdftex do the
274 letterspacing. The <package>microtype</package> package gives
275 LaTeX users access to this feature.</para>
276 </listitem>
277 </varlistentry>
278
279 <varlistentry>
280 <term><option>-l</option> <replaceable>ligkern_spec</replaceable></term>
281 <term><option>-L</option> <replaceable>ligkern_spec</replaceable></term>
282 <listitem>
283 <para> See the section
284 on <link linkend="lspecs">extra ligkern info</link>
285 for details.</para>
286 </listitem>
287 </varlistentry>
288
289 <varlistentry>
290 <term><option>-n</option></term>
291 <listitem>
292 <para>No prefix. For .enc- and .lig files, the program normally
293 first prefixes the name with `afm2pl-'. Only if the prefixed
294 filename is not found, will it search for the original
295 filename. This option prevents searching for the prefixed filename.
296 </para>
297 </listitem>
298 </varlistentry>
299
300 <varlistentry>
301 <term><option>-V</option></term>
302 <listitem>
303 <para>Verbose. If turned on, it reports the number of missing
304 glyphs to stderr and their names to stdout.
305 </para>
306 </listitem>
307 </varlistentry>
308
309 <varlistentry>
310 <term><option>--help</option></term>
311 <listitem>
312 <para>Display a short usage message.</para>
313 </listitem>
314 </varlistentry>
315
316 <varlistentry>
317 <term><option>--version</option></term>
318 <listitem>
319 <para>Display the version number of afm2pl.</para>
320 </listitem>
321 </varlistentry>
322 </variablelist>
323 </refsect1>
324
325 <refsect1>
326 <title>Mapfile entries</title>
327 <para>afm2pl writes a mapfile entry to a file with the same basename
328 as the pl output file, but with extension .map. It can be used for
329 the dvips mapfile and for the pdftex mapfile. It is assumed that the
330 pfb file has the same basename as the afm file and must be
331 downloaded. <emphasis>You may have to hand-edit this
332 entry.</emphasis></para>
333
334 <para>You can configure dvips and pdftex to read this additional
335 mapfile or otherwise add the entry to an existing mapfile.</para>
336
337 <para id="mapwarn"><emphasis role="strong">Check your
338 mapfiles!</emphasis> To reduce the likelihood of name conflicts,
339 the .enc- files which are part of afm2pl (ot1, ot1csc, ot1ital,
340 ot1tt, texnanlc and texnanuc) have now been prepended
341 with <literal>afm2pl-</literal>. The .enc files are referenced in
342 mapfiles. If you have old afm2pl-generated .tfm files using these,
343 then you should update their mapfile fragments and rerun updmap or
344 updmap-sys. Or you can copy the relevant enc files to your
345 personal or local texmf tree under their previous non-prefixed
346 names.</para>
347 </refsect1>
348
349 <refsect1 id="lspecs" xreflabel="ligkern specs">
350 <title>Extra ligkern info</title>
351
352 <para><emphasis>Most users are well-advised to leave this mess alone
353 and to accept the default behavior.</emphasis></para>
354
355 <para>The ligatures and kerns present in the afm file can be
356 modified in various ways. Default, the encoding file is scanned for
357 extra ligkern specifications, whose format will be described below.
358 If there are no ligkern specifications in the encoding file, then
359 extra ligkern specifications will be read from a file
360 [afm2pl-]default.lig. A value of 0
361 for <replaceable>ligkern_spec</replaceable> means that the ligatures
362 and kerns from the afm file won't be tampered with and a value of 1
363 specifies default behavior. One can also specify a comma-separated
364 list of files with extra ligkerns specs.</para>
365
366 <para>If afm2pl is compiled with the kpathsea library, then these
367 files will be searched for under $TEXMF/fonts/lig.</para>
368
369 <para><emphasis>Note that ligatures and kerns are hints for the
370 typesetting application; there is no need to download this
371 information to the printer or to make it available to a dvi
372 driver.</emphasis></para>
373
374 <para>The parser for ligkern info has been inherited from afm2tfm
375 virtually without change. A ligkern specification can have one of
376 the following forms:</para>
377
378 <screen>
379 <replaceable>glyph_name1</replaceable> <replaceable>glyph_name2</replaceable> <replaceable>lig_op</replaceable> <replaceable>glyph_name3</replaceable> ;
380 </screen>
381
382 <para>This specifies a ligature. Possible values for
383 <replaceable>lig_op</replaceable> are <literal>=:</literal>,
384 <literal>|=:</literal>, <literal>|=:></literal>,
385 <literal>=:|</literal>, <literal>=:|></literal>,
386 <literal>|=:|</literal>, <literal>|=:|></literal> and
387 <literal>|=:|&gt;&gt;</literal>.
388 These correspond to <literal>LIG</literal>,
389 <literal>/LIG</literal>, <literal>/LIG&gt;</literal>,
390 <literal>LIG/</literal>, <literal>LIG/&gt;</literal>,
391 <literal>/LIG/</literal>, <literal>/LIG/&gt;</literal>,
392 <literal>/LIG/&gt;&gt;</literal> in .pl syntax; see the pltotf
393 documentation and the .lig files in the distribution.</para>
394
395 <screen>
396 <replaceable>glyph_name1</replaceable> &lt;&gt; <replaceable>glyph_name2</replaceable> ;
397 </screen>
398
399 <para>Kern <replaceable>glyph_name1</replaceable> as
400 <replaceable>glyph_name2</replaceable>.</para>
401
402 <screen>
403 <replaceable>glyph_name1</replaceable> {} <replaceable>glyph_name2</replaceable> ;
404 </screen>
405
406 <para>Remove the kern between <replaceable>glyph_name1</replaceable>
407 and <replaceable>glyph_name2</replaceable>. A value of
408 <literal>*</literal> for either glyph name is interpreted as a
409 wildcard.</para>
410
411 <screen>
412 || = <replaceable>glyph</replaceable> ;
413 </screen>
414
415 <para>Set the (right) boundary character to
416 <replaceable>glyph</replaceable>. <replaceable>glyph</replaceable>
417 may be either a glyphname or a slot in the encoding vector. Choosing
418 a glyph which doesn't occur in the output encoding is equivalent to
419 not specifying a boundarychar at all. It is ok to pick an encoded
420 glyphname which does not occur in the afm. In fact, this is what
421 default.lig does: <literal>|| = cwm ;</literal>.</para>
422
423 <para>You can copy the kerns of an unencoded character to the
424 boundarychar. Below, <literal>space</literal> is the unencoded
425 character:</para>
426
427 <screen>
428 || &lt;&gt; space ;
429 </screen>
430
431 <para>This ligkern specification should occur before the one that
432 deletes space kerns.</para>
433
434 <para>A ligkern specification should be contained within one line.
435 One line may contain several ligkern specifications, separated by
436 spaces. Note that <literal> ;</literal> (space followed by
437 semicolon) is considered part of the ligkern specification. See the
438 lig files included in this distribution. Example:</para>
439
440 <screen>
441 one {} * ; * {} one ; two {} * ; * {} two ;
442 </screen>
443
444 <para>Lines with ligkern specifications inside an encoding file
445 should start with <literal>% LIGKERN </literal>. Ligkern
446 specifications in a lig file may optionally start this way.</para>
447 </refsect1>
448
449 <refsect1 id="lspace" xreflabel="letterspacing">
450 <title>Letterspacing and extra ligkern info</title>
451
452 <para>Letterspacing has various side-effects for ligkern
453 info. Instead of simply applying the extra ligkern info (see
454 previous section), the following is done:</para>
455
456 <orderedlist>
457 <listitem><para>In case of positive letterspacing, native ligatures
458 are removed, unless the -k option is specified.</para></listitem>
459
460 <listitem><para>Extra ligkern info is applied as usual, except that in
461 case of positive letterspacing different defaults apply:
462 <literal>-l 0</literal> is quietly ignored, ligkern comments in
463 the encoding file are ignored, and defpre.lig is read instead of
464 default.lig.</para></listitem>
465
466 <listitem><para>Letterspacing is applied. This adds a lot of kerns,
467 and modifies existing kerns.</para></listitem>
468
469 <listitem><para>The extra ligkern info specified with -L is applied.
470 The only ligkern specs which are allowed here, are removals of
471 kerning pairs (with the <literal>{}</literal> operator). Values 0
472 and 1 have a similar meaning as for the -l
473 parameter. <emphasis id="lspacewarn">The tfm format has room for
474 only about 180x180 ligatures and kerning pairs.</emphasis> This is
475 enough for OT1 encoding, but for texnansi encoding quite a few
476 ligkern specifications have to be removed. The pltotf program will
477 remove <emphasis>all</emphasis> ligkern info if too many ligatures
478 and kerns remain. The default lig file is defpost.lig. This file
479 throws out kerning pairs which are unlikely to be involved in
480 letterspacing, such as kerns involving accents or kerns with a
481 punctuation character or right bracket at the left. It does not add
482 letterspacing kerns involving boundarychars. Instead, fontspace is
483 increased by twice the letterspacing. defpost.lig throws out enough
484 kerns in case of texnansi encoding. With other encodings, you may
485 have to throw out additional kerning
486 pairs.</para></listitem> </orderedlist>
487 </refsect1>
488
489 <refsect1>
490 <title>Font-based upper- and lowercasing</title>
491
492 <para>The distribution includes encoding vectors texnanuc.enc and
493 texnanlc.enc which produce all-uppercase and all-lowercase
494 fonts</para>
495
496 <para>The principal uses for an all-uppercase font are page headers
497 and section heads. If these contain math, then macro-based
498 uppercasing would create unpleasant complications. Example:
499 <programlisting>
500 afm2pl -p texnanuc ptmr8a ptmup8y
501 pltotf ptmup8y
502 </programlisting>
503 For best results, you should add some letterspacing. In LaTeX, this
504 is best done with the <package>microtype</package>
505 package; see the documentation of that package. But it can also be
506 done with <package>afm2pl</package>:
507 <programlisting>
508 afm2pl -p texnanuc -m 100 ptmr8a ptmup8y
509 </programlisting>
510 This requires caution;
511 see <link linkend="lspacewarn">above.</link></para>
512
513 <para>You can use this new font within the context of LaTeX font
514 selection as follows:
515 <programlisting>
516 <![CDATA[
517 <preamble commands>
518 \makeatletter
519 {\nfss@catcodes
520 \DeclareFontShape{LY1}{ptm}{m}{upp}{<-> ptmup8y}{}}
521 \makeatother
522 ...
523 \begin{document}
524 ...
525 {\fontshape{upp}\selectfont uppercase text}
526 ]]>
527 </programlisting>
528 Note that <code>upp</code> is simply a newly made-up shape name.</para>
529
530 <refsect2>
531 <title>The sz ligature &szlig;</title>
532 <para>Note that the texnanuc encoding provides no glyph for the sz
533 ligature &szlig;; you'll either have to substitute ss or provide a
534 macro-based solution. The following code uses either the usual glyph
535 or substitutes the letters ss, depending on whether the glyph exists
536 in the current font:</para>
537
538 <programlisting>
539 <![CDATA[
540 \def\ss{%
541 \setbox0\hbox{\char25}%
542 \ifnum\wd0=0 ss\else\box0\fi
543 }
544 ]]>
545 </programlisting>
546 <para>In LaTeX, this code appears to work well enough, although on
547 occasion you may need to insert <literal>\protect</literal>. A
548 better solution might involve the sixth parameter of the
549 <literal>\DeclareFontShape</literal> macro, but I failed to get
550 that to work.</para>
551 </refsect2>
552 </refsect1>
553
554 <refsect1>
555 <title>Afm2pl, fontinst and artificial smallcaps</title>
556
557 <para>Afm2pl doesn't do virtual fonts. That means that for
558 things such as artificial smallcaps you have to turn elsewhere,
559 e.g. to the fontinst package, which is part of any mainstream TeX
560 distribution.</para>
561
562 <para>Look under texmf/tex/fontinst for fontinst support files,
563 which allow you to generate a smallcaps font (tfm and vf files) from
564 an afm2pl-generated tfm file. This package only supports texnansi
565 encoding.</para>
566
567 <para>There should be no real problem in doing the same for OT1
568 encoding. However, there are several variations of the OT1 encoding
569 to take care of. Also, there are as far as I know no officially
570 sanctioned PostScript names for all the variations of the OT1
571 encoding; the fontinst names contain spaces and are therefore not
572 useable as PostScript names.</para>
573 </refsect1>
574
575 <refsect1>
576 <title>Changed in version 0.7.1</title>
577
578 <para>In order to avoid name conflicts, the .enc- and .lig files
579 distributed with afm2pl got <literal>afm2pl-</literal> prepended
580 to their name. The program itself now first searches for the thus
581 prepended name. If the .enc- or .lig file is not found it will
582 look for the original filename. The renaming of the afm2pl .enc
583 files may require modification of some mapfiles.</para>
584 </refsect1>
585
586 <refsect1><title>Urls</title>
587 <para>The afm2pl homepage is <ulink
588 url="http://tex.aanhet.net/afm2pl/">http://tex.aanhet.net/afm2pl/</ulink>.</para>
589
590 <para>The paper
591 <ulink url="http://www.tug.org/TUGboat/Articles/tb27-1/tb86kroonenberg-fonts.pdf">Font
592 installation the shallow way</ulink> (EuroTeX 2006 Proceedings,
593 published
594 as <ulink url="http://www.tug.org/TUGboat/">TUGboat</ulink> issue
595 27.1) illustrates the use of afm2pl.</para>
596 </refsect1>
597
598 </refentry>