Debian Codegraph @

contrib/mom/momdoc/appendices.html

raw
1 <?xml version="1.0" encoding="utf-8"?>
2 <!--
3 This file is part of groff, the GNU roff type-setting system.
4
5 Copyright (C) 2004-2020 Free Software Foundation, Inc.
6 Written by Peter Schaffter ([email protected]).
7
8 Permission is granted to copy, distribute and/or modify this document
9 under the terms of the GNU Free Documentation License, Version 1.3 or
10 any later version published by the Free Software Foundation; with no
11 Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
12 Texts.
13
14 A copy of the Free Documentation License is included as a file called
15 FDL in the main directory of the groff source package.
16 -->
17
18 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
19 <html xmlns="http://www.w3.org/1999/xhtml">
20
21 <head>
22 <meta http-equiv="content-type" content="text/html;charset=utf-8"/>
23 <title>Mom -- Appendices</title>
24 <link rel="stylesheet" type="text/css" href="stylesheet.css" />
25 </head>
26
27 <body style="background-color: #f5faff;">
28
29 <!-- ==================================================================== -->
30
31 <div id="top" class="page">
32
33 <!-- Navigation links -->
34 <table style="width: 100%;">
35 <tr>
36 <td><a href="toc.html">Back to Table of Contents</a></td>
37 </tr>
38 </table>
39
40 <h1 id="appendices" class="docs">Appendices</h1>
41
42 <div style="width: 68%; margin: auto;">
43 <ul class="no-enumerator">
44 <li><a href="#fonts">Adding fonts to groff</a>
45 <ul style="margin-left: -.5em; list-style-type: disc">
46 <li><a href="#extending">Extending groff families / adding new families and fonts</a>
47 <ul style="margin-left: -.5em; list-style-type: circle">
48 <li><a href="#traditional">The traditional approach</a></li>
49 <li><a href="#simpler">The simpler way with mom</a></li>
50 </ul></li>
51 <li><a href="#steps">Step-by-step instructions</a></li>
52 <li><a href="#install-font">Automate the whole process &ndash; the install-font script</a></li>
53 </ul></li>
54 <li><a href="#codenotes">Some reflections on mom</a></li>
55 <li><a href="#contact">Contact the author</a></li>
56 </ul>
57 </div>
58
59 <div class="rule-medium"><hr/></div>
60
61 <h2 id="fonts" class="docs">Adding fonts to groff</h2>
62
63 <div id="small-note" class="box-tip">
64 <p class="tip-top">
65 <kbd>&lt;prefix&gt;</kbd>, in this section, refers
66 to the directory in which groff is installed, typically
67 <br/>
68 <span class="pre-in-pp">
69 /usr/share/groff/
70 </span>
71 (for distro-specific, pre-compiled groff packages) or
72 <br/>
73 <span class="pre-in-pp">
74 /usr/local/share/groff/
75 </span>
76 (if you&#8217;ve built groff from source).
77 </p>
78
79 <p class="tip-bottom">
80 <kbd>&lt;version&gt;</kbd> refers to the groff version number, which
81 can be found, if necessary, by typing
82 <br/>
83 <span class="pre-in-pp">
84 groff -v
85 </span>
86 at the command line.
87 </p>
88 </div>
89
90 <p>
91 Groff comes with a small library of
92 <a href="definitions.html#family">families</a>
93 (see the
94 <a href="typesetting.html#family">FAMILY</a>
95 macro for a list). The families have four
96 <a href="definitions.html#font">fonts</a>
97 associated with them. These fonts are a combination of
98 <a href="definitions.html#weight">weight</a>
99 and
100 <a href="definitions.html#shape">shape</a>:
101 <br/>
102 <span class="pre-in-pp">
103 R (Roman, usually Medium weight),
104 I (Italic, usually Medium weight),
105 B (Bold, usually Roman shape) and
106 BI (Bold Italic)
107 </span>
108 If you work with mom a lot, sooner or later you&#8217;ll find that these
109 families and their associated fonts aren&#8217;t sufficient. You&#8217;ll
110 want to supplement them, either with more fonts for the families
111 already provided&mdash;<i>Damn! I need Helvetica Bold Condensed
112 Italic</i>&mdash;or with entire new families.
113 </p>
114
115 <h3 id="extending" class="docs">Extending groff families / adding new families and fonts</h3>
116
117 <h4 id="traditional" class="docs">The traditional approach</h4>
118
119 <p>
120 The traditional approach to extending groff families has been
121 to create new families for non-default weights and shapes (e.g.
122 <b>Light</b>, which is a
123 <a href="definitions.html#weight">weight</a>,
124 or <b>Condensed</b>, which is a
125 <a href="definitions.html#shape">shape</a>),
126 then to associate them with groff&#8217;s predefined <b>R,
127 I, B</b> and <b>BI</b> font styles. An example of this
128 can be seen in the groff PostScript font library itself, which is
129 found in
130 <br/>
131 <span class="pre-in-pp">
132 &lt;prefix&gt;/&lt;version&gt;/font/devps/
133 </span>
134 There&#8217;s one &#8220;family&#8221; for Helvetica (<b>HR</b>,
135 <b>HI</b>, <b>HB</b>, <b>HBI</b>) and another for Helvetica Narrow
136 (<b>HNR</b>, <b>HNI</b>, <b>HNB</b>, <b>HNBI</b>).
137 </p>
138
139 <p>
140 The difficulty with this approach is that typographers tend to
141 think of families as referring to the entire set of font weights
142 and shapes associated with a family name. For example, when
143 a typesetter says &#8220;the Helvetica family&#8221;, s/he is
144 including the weights Helvetica Thin, Helvetica Light, Helvetica
145 Regular, Helvetica Bold, Helvetica Heavy, etc, and all their
146 associated shapes (Roman, Italic, Condensed, Narrow, Extended,
147 Outline, etc).
148 </p>
149
150 <p>
151 Thus, intuitively, when a typesetter gives mom a
152 <kbd>.FAMILY&nbsp;H</kbd> directive, s/he reasonably expects that
153 any subsequent <kbd>.FT</kbd> directive will access the desired font
154 from the Helvetica family&mdash;without the need to state explicitly
155 both family and font to <kbd>.FT</kbd>, as it is explained one can
156 do in the
157 <a href="typesetting.html#family">FAMILY</a>
158 and
159 <a href="typesetting.html#font">FT</a>
160 sections of these documents.
161 </p>
162
163 <p>
164 If one had, say, Helvetica Light Roman and Helvetica Light Italic
165 as well as Helvetica Light Condensed Roman and Helvetica Light
166 Condensed Italic, the established groff approach would require two
167 &#8220;partial&#8221; families, <b>HL</b> (for Helvetica Light)
168 and <b>HLCD</b> (for Helvetica Light Condensed), with <b>R</b> and
169 <b>I</b> fonts for both:
170 <br/>
171 <span class="pre-in-pp">
172 HLR
173 HLI
174 HLCDR
175 HLCDI
176 </span>
177 Accessing these family/font combos routinely
178 throughout a document would then require changing the family
179 (with <kbd>.FAMILY</kbd>) and selecting the desired font
180 (with <kbd>.FT&nbsp;R</kbd> or <kbd>.FT&nbsp;I</kbd>), or
181 passing <kbd>.FT</kbd> the lengthy family+fontname (.e.g.
182 <kbd>.FT&nbsp;HLCDI</kbd>).
183 </p>
184
185 <h4 id="simpler" class="docs">The simpler way with mom</h4>
186
187 <p>
188 Fortunately, groff provides a mechanism whereby it&#8217;s possible
189 to extend the basic <b>R</b>, <b>I</b>, <b>B</b>, and <b>BI</b> fonts
190 (&#8220;styles&#8221; in groff-speak) so that one can, in fact,
191 create extensive type families, and access all the fonts in them
192 with <kbd>.ft</kbd> (groff) or <kbd>.FT</kbd> (mom).
193 </p>
194
195 <p>
196 Mom uses this mechanism to offer, in addition to groff&#8217;s
197 default font styles, the following:
198 </p>
199
200 <div class="examples-container" style="padding-bottom: 1em;">
201 <div id="style-extensions" style="width: 50%; float: left;">
202 <span class="pre" style="font-size: 85%">
203 UL = Ultra Light
204 ULI = Ultra Light Italic
205 ULCD = Ultra Light Condensed
206 ULCDI = Ultra Light Condensed Italic
207 ULEX = Ultra Light Extended
208 ULEXI = Ultra Light Extended Italic
209
210 XL = Extra Light
211 XLI = Extra Light Italic
212 XLCD = Extra Light Condensed
213 XLCDI = Extra Light Condensed Italic
214 XLEX = Extra Light Extended
215 XLEXI = Extra Light Extended Italic
216
217 TH = Thin
218 THI = Thin Italic
219 THCD = Thin Condensed
220 THCDI = Thin Condensed Italic
221 THEX = Thin Extended
222 THEXI = Thin Extended Italic
223
224 L = Light Roman
225 LI = Light Italic
226 LCD = Light Condensed
227 LCDI = Light Condensed Italic
228 LEX = Light Extended
229 LEXI = Light Extended Italic
230
231 BK = Book Roman
232 BKI = Book Italic
233 BKCD = Book Condensed
234 BKCDI = Book Condensed Italic
235 BKEX = Book Extended
236 BKEXI = Book Extended Italic
237
238 CD = Medium Condensed
239 CDI = Medium Condensed Italic
240 EX = Medium Extended
241 EXI = Medium Extended Italic
242
243 DB = DemiBold Roman
244 DBI = DemiBold Italic
245 DBCD = DemiBold Condensed
246 DBCDI = DemiBold Condensed Italic
247 DBEX = DemiBold Extended
248 DBEXI = DemiBold Extended Italic
249
250 SB = SemiBold Roman
251 SBI = SemiBold Italic
252 SBCD = SemiBold Condensed
253 SBCDI = SemiBold Condensed Italic
254 SBEX = SemiBold Extended
255 SBEXI = SemiBold Extended Italic
256 </span>
257 </div>
258 <span class="pre" style="font-size: 85%">
259 BCD = Bold Condensed
260 BCDI = Bold Condensed Italic
261 BEX = Bold Extended
262 BEXI = Bold Extended Italic
263 BO = Bold Outline
264
265 XB = Extra Bold
266 XBI = Extra Bold Italic
267 XBCD = Extra Bold Condensed
268 XBCDI = Extra Bold Condensed Italic
269 XBEX = Extra Bold Extended
270 XBEXI = Extra Bold Extended Italic
271
272 UB = Ultra Bold
273 UBI = Ultra Bold Italic
274 UBCD = Ultra Bold Condensed
275 UBCDI = Ultra Bold Condensed Italic
276 UBEX = Ultra Bold Extended
277 UBEXI = Ultra Bold Extended Italic
278
279 HV = Heavy
280 HVI = Heavy Italic
281 HVCD = Heavy Condensed
282 HVCDI = Heavy Condensed Italic
283 HVEX = Heavy Extended
284 HVEXI = Heavy Extended Italic
285
286 BL = Black
287 BLI = Black Italic
288 BLCD = Black Condensed
289 BLCDI = Black Condensed Italic
290 BLEX = Black Extended
291 BLEXI = Black Extended Italic
292 BLO = Black Outline
293
294 XBL = Extra Black
295 XBLI = Extra Black Italic
296 XBLCD = Extra Black
297 XBLCDI = Extra Black
298 XBLEX = Extra Black Italic
299 XBLEXI = Extra Black Italic
300
301 UBL = Ultra Black
302 UBLI = Ultra Black Italic
303 UBLCD = Ultra Black Condensed
304 UBLCDI = Ultra Black Condensed Italic
305 UBLEX = Ultra Black Extended
306 UBLEXI = Ultra Black Extended Italic
307
308 SC = Small Caps Roman
309 SCI = Small Caps Italic
310 SCDB = Small Caps Demibold
311 SCDBI = Small Caps Demibold Italic
312 SCSB = Small Caps Semibold
313 SCSBI = Small Caps Semibold Italic
314 </span>
315 </div>
316
317 <p style="clear: both;">
318 Thus, with mom, if you&#8217;ve installed some extra
319 Helvetica fonts and named them according to the convention
320 <kbd>&lt;F&gt;&lt;S&gt;</kbd> (where <kbd>&lt;F&gt;</kbd> means
321 family and <kbd>&lt;S&gt;</kbd> means font style), once having
322 entered
323 <br/>
324 <span class="pre-in-pp" style="margin-bottom: -1em;">
325 .FAMILY H
326 </span>
327 you can access any of the extra Helvetica fonts simply by passing
328 the correct argument to
329 <a href="typesetting.html#font">FT</a>
330 from the list, above. For example, if you were working in Medium
331 Roman (<kbd>.FT&nbsp;R</kbd>) and you needed Medium Condensed Italic
332 for a while (assuming it&#8217;s installed), you&#8217;d just type
333 <br/>
334 <span class="pre-in-pp" style="margin-bottom: -1em;">
335 .FT CDI
336 </span>
337 to access the Medium Condensed Italic font from the Helvetica
338 family.
339 </p>
340
341 <p>
342 Mom&#8217;s list of font styles doesn&#8217;t pretend to be
343 exhaustive. The extension names are arbitrary and can be used in a
344 flexible manner. For example, if you create a family that has a
345 Demibold font (<b>DB</b>) but no Bold font (<b>B</b>), you might
346 find it more convenient to give the Demibold font the extension
347 &#8220;<b>B</b>&#8221;.
348 </p>
349
350 <p id="register-style">
351 You may, at needs, want to add to mom&#8217;s list of font styles.
352 You can do this by editing the file, om.tmac (typical location:
353 <kbd>&lt;prefix&gt;/&lt;version&gt;/tmac/om.tmac</kbd>). Near the
354 top, you&#8217;ll see lines of the form
355 <br/>
356 <span class="pre-in-pp">
357 .sty \n[.fp] XL \" Extra Light
358 .sty \n[.fp] L \" Light Roman
359 .sty \n[.fp] LI \" Light Italic
360 .sty \n[.fp] LCD \" Light Condensed Roman
361 </span>
362 Simply add your new font style by imitating what you see, above,
363 and plugging in your new font style (having, of course,
364 added the font to groff, correctly named); see
365 <a href="#steps">Step-by-step instructions</a>).
366 </p>
367
368 <p>
369 For example, if you already have some fonts from the Univers family
370 installed and have called the family <b>Univers</b>, you might decide at
371 some point to add the Bold Outline font (<b>UniversBO</b>). In which
372 case, you&#8217;d add
373 <br/>
374 <span class="pre-in-pp">
375 .sty \n[.fp] BO \" Bold Outline
376 </span>
377 to the <kbd>.sty&nbsp;\n[.fp]&nbsp; &lt;font style&gt;</kbd> list
378 in om.tmac.
379 </p>
380
381 <div class="box-tip">
382 <p class="tip">
383 <span class="note">Note:</span>
384 Mom&#8217;s font extensions are not &#8220;user-space&#8221;
385 controllable via a macro. If you&#8217;ve been using groff for
386 a long time, and have already rolled your own solution to adding
387 families and fonts to groff, you may find that mom&#8217;s font
388 extensions conflict with your own scheme. Should that be the case,
389 comment out the <kbd>.sty&nbsp;\n[.fp] &lt;font style&gt;</kbd>
390 lines found near the top of the <kbd>om.tmac</kbd> file.
391 </p>
392 </div>
393
394 <div class="box-important">
395 <p class="tip">
396 <span class="important">Important:</span>
397 Be careful that any styles you add do not conflict with
398 <i>family</i> names that already exist. &#8220;<b>C</b>&#8221;,
399 for example, conflicts with the Courier family (<b>CR</b>,
400 <b>CI</b>, <b>CB</b>, <b>CI</b>). Were you to create a font
401 style &#8220;<b>C</b>&#8221;, thinking that <kbd>.FT&nbsp;C</kbd>
402 would give you access to font style once you&#8217;d given a
403 <kbd>.FAMILY</kbd> directive, you&#8217;d get a nasty surprise:
404 your type would come out in Courier Roman!
405 </p>
406 </div>
407
408 <div class="rule-medium"><hr/></div>
409
410 <h2 id="steps" class="docs">Step-by-step instructions</h2>
411
412 <div>
413 <ul class="no-enumerator" style="margin-left: -1.5em;">
414 <li><a href="#need">What you need before you start</a></li>
415 <li><a href="#preparation">Initial preparation</a></li>
416 <li><a href="#step-1">1. Acquire the font</a></li>
417 <li><a href="#step-2">2. Prepare to convert the font to the correct format</a>
418 <ul style="margin-left: -.5em">
419 <li><a href="#ttf">TTF fonts</a></li>
420 <li><a href="#type1">Type 1 fonts</a></li>
421 </ul></li>
422 <li><a href="#step-3">3. Convert the font and put it in the right place</a></li>
423 <li><a href="#step-4">4. Update the download file</a>
424 <ul style="margin-left: -.5em">
425 <li><a href="#internal">Get the internal font name</a></li>
426 <li><a href="#add">Add the font to the download file</a></li>
427 <li><a href="#gropdf-download">Updating the gropdf download file</a></li>
428 </ul></li>
429 <li><a href="#groff-font-names">Naming groff fonts</a></li>
430 <li><a href="#install-font">Automate the whole process &ndash; the install-font script</a>
431 </li>
432 </ul>
433 </div>
434
435
436 <p>
437 There are a number of ways to approach making fonts available
438 to groff. These instructions aren&#8217;t meant to cover all
439 possibilities, merely one.
440 </p>
441
442 <p>
443 GNU/Linux distributions being what they are, directory locations
444 may differ and the presence of some executable can&#8217;t be
445 guaranteed. I run a Debian-based system. The instructions reflect
446 that. Users of other distros may have to interpret them according
447 to the way their distro operates.
448 </p>
449
450 <h3 id="need" class="docs appendices">What you need before you start</h3>
451
452 <ul style="margin-top: 1em; margin-left: -.5em;">
453 <li>groff, version 1.18 or higher<br/>
454 (Debian package: groff)
455 </li>
456 <li>ghostscript<br/>
457 (Debian package: ghostscript or ghostscript-x)
458 </li>
459 <li>fontforge<br/>
460 (Debian package: fontforge)
461 </li>
462 </ul>
463
464 <h3 id="preparation" class="docs appendices">Initial preparation (you only need do this once)</h3>
465
466 <ol id="site-font" style="margin-left: -1em;">
467 <li>
468 Locate the groff directory,
469 <kbd class="nobr">site-font</kbd>. The exact location is
470 difficult to predict, owing to differences between distros and
471 whether you&#8217;re using a pre-packaged groff or have built
472 it from source. Some typical locations are:
473 <br/>
474 <span class="pre-in-pp" style="margin-bottom: -2em;">
475 /usr/share/groff/
476 /usr/local/share/groff/
477 /etc/groff/
478 </span>
479 If you can&#8217;t find the site-font directory, locate
480 groff&#8217;s <kbd class="nobr">site-tmac</kbd> directory, and, as root,
481 create site-font in the same directory. Eg, if you find
482 site-tmac in <kbd class="nobr">/usr/share/groff/</kbd>, create site-font in
483 <kbd class="nobr">/usr/share/groff/</kbd>
484 <br/>
485 <span class="pre-in-pp" style="margin-bottom: -2em;">
486 sudo mkdir site-font
487 </span>
488 </li>
489 <li>
490 Create two files, generate-t42.pe and generate-pfa.pe,
491 as you see them below. Place them in a convenient and
492 easily-remembered location, like your home directory.
493 <br/>
494 <span class="examples" style="font-size: 95%; display: block; margin-top: .5em;">generate-t42.pe</span>
495
496 <div class="examples-container" style="margin-top: 0; margin-bottom: -1em; padding-bottom: 1em;">
497 <span class="pre">
498 # generate-t42.pe
499
500 Open($1);
501 Generate($fontname + ".pfa");
502 Generate($fontname + ".t42");
503 </span>
504 </div>
505 <br/>
506 <span class="examples" style="font-size: 95%; display: block; margin-top: .5em;">generate-pfa.pe</span>
507 <div class="examples-container" style="margin-top: 0; padding-bottom: 1em;">
508 <span class="pre">
509 # generate-pfa.pe
510
511 Open($1);
512 Generate($fontname + ".pfa");
513 </span>
514 </div>
515 </li>
516 </ol>
517
518 <h3 id="step-1" class="docs appendices">Step 1: Acquire the font</h3>
519
520 <p class="top">
521 The two most commonly available types of fonts are PostScript Type1
522 (extension .pfb) and TrueType (extension .ttf). Either can be made
523 available to groff. There are many websites holding collections of
524 both.
525 </p>
526
527 <h3 id="step-2" class="docs appendices">Step 2: Prepare to convert the font to the correct format</h3>
528
529 <p class="top">
530 Change into the directory holding the new font.
531 </p>
532
533 <p>
534 For convenience in the next step, make a symbolic link to
535 the file 'textmap':
536 <br/>
537 <span class="pre-in-pp">
538 ln -s &lt;prefix&gt;/&lt;version&gt;/font/devps/generate/textmap .
539 </span>
540 See
541 <a href="#small-note">here</a>
542 for an explanation of <kbd>&lt;prefix&gt;</kbd>
543 and <kbd>&lt;version&gt;</kbd>.
544 </p>
545
546 <p>
547 In addition, unless you&#8217;re installing fonts from your home
548 directory, make links to the files 'generate-t42.pe' and
549 'generate-pfa.pe'.
550 <br/>
551 <span class="pre-in-pp">
552 ln -s $HOME/generate-t42.pe .
553 ln -s $HOME/generate-pfa.pe .
554 </span>
555 </p>
556
557 <h3 id="step-3" class="docs appendices">Step 3: Convert the font and put it in the right place</h3>
558
559 <p class="top">
560 TrueType fonts (.ttf) need to be converted to .t42. Type 1 fonts
561 (.pfa, .pfb) need to be converted to .pfa.
562 </p>
563
564 <h4 id="ttf" class="docs" style="font-size: 90%; text-transform: uppercase;">&nbsp;&bull;&nbsp;Converting TTF Fonts</h4>
565
566 <p class="top" style="margin-top: .5em;">
567 For .ttf fonts, run
568 <br/>
569 <span class="pre-in-pp">
570 fontforge -script generate-t42.pe &lt;file&gt;.ttf
571 </span>
572 This will create three new files with the extensions .t42, .pfa, and
573 .afm. Next, run
574 <br/>
575 <span class="pre-in-pp">
576 afmtodit &lt;afm file&gt; textmap &lt;groff font&gt;
577 </span>
578 This will create a groff font with the name you give. (See
579 <a href="#groff-font-names">here</a>
580 for advice on naming groff fonts.)
581 </p>
582
583 <p>
584 Move the .t42 and groff font files to
585 <kbd class="nobr">&lt;prefix&gt;/site-font/devps/</kbd>.
586 </p>
587
588 <p>
589 If you&#8217;re running a recent version of groff that includes
590 the native pdf device (gropdf), move the .pfa file to <kbd
591 class="nobr">&lt;prefix&gt;/site-font/devpdf/</kbd>. If not, you
592 may safely remove it. You may also safely remove the .afm file.
593 </p>
594
595 <h4 id="type1" class="docs" style="font-size: 90%; text-transform: uppercase;">&nbsp;&bull;&nbsp;Converting Type1 Fonts</h4>
596
597 <p class="top" style="margin-top: .5em;">
598 For .pfb fonts, run
599 <br/>
600 <span class="pre-in-pp">
601 fontforge -script generate-pfa.pe &lt;file&gt;.pfb
602 </span>
603 This will create two new files with the extensions .pfa, and .afm.
604 Next, run
605 <br/>
606 <span class="pre-in-pp">
607 afmtodit &lt;afm file&gt; textmap &lt;groff font&gt;
608 </span>
609 Move the .pfa and groff font files to
610 <kbd class="nobr">&lt;prefix&gt;/&lt;site-font&gt;/devps/</kbd>.
611 (See
612 <a href="#groff-font-names">here</a>
613 for advice on naming groff fonts.)
614 </p>
615
616 <p>
617 If you&#8217;re running a recent version of groff that includes the
618 native pdf device (gropdf), link the .pfa and groff font files, now
619 in <kbd class="nobr">&lt;prefix&gt;/&lt;site-font&gt;/devps/</kbd>,
620 to the <kbd class="nobr">&lt;prefix&gt;/site-font/devpdf</kbd>
621 directory.
622 </p>
623
624 <p>
625 Start by changing into the
626 <kbd class="nobr">&lt;prefix&gt;/site-font/devpdf/</kbd>
627 directory, then:
628 <br/>
629 <span class="pre-in-pp">
630 ln -s &lt;prefix&gt;/&lt;site-font&gt;/devps/&lt;file&gt;.pfa .
631 ln -s &lt;prefix&gt;/&lt;site-font&gt;/devps/&lt;groff font&gt; .
632 </span>
633 You may safely remove the .afm file.
634 </p>
635
636 <h3 id="step-4" class="docs appendices">Step 4: Update the download file</h3>
637
638 <h4 id="internal" class="docs" style="font-size: 90%; text-transform: uppercase;">&nbsp;&bull;&nbsp;Get the internal font name</h4>
639
640 <p class="top" style="margin-top: .5em;">
641 Inspect your new groff font file. Near the top, you will see a line
642 of the form
643 <br/>
644 <span class="pre-in-pp">
645 internalname &lt;name&gt;
646 </span>
647 Usually, the internal name is helpfully descriptive, e.g.
648 <br/>
649 <span class="pre-in-pp">
650 internalname Optima-Bold
651 </span>
652 Make a note of the internal name.
653 </p>
654
655 <h4 id="add" class="docs" style="font-size: 90%; text-transform: uppercase;">&nbsp;&bull;&nbsp;Add the font to the download file</h4>
656
657 <p class="top" style="margin-top: .5em;">
658 If a file called &#8216;download&#8217; is not already present in
659 <kbd class="nobr">&lt;prefix&gt;/site-font/devps/</kbd>,
660 copy over the one found in
661 <kbd class="nobr">&lt;prefix&gt;/&lt;version&gt;/font/devps/</kbd>.
662 </p>
663
664 <p>
665 The download file maps the internal names used by groff to the
666 actual fonts. To add your new font to the download file, append a
667 line containing the internal name, followed by a tab (make sure your
668 text editor is inserting the tab character, not spaces), followed by
669 the .t42 or .pfa font to which the internal name refers.
670 </p>
671
672 <p>
673 For example, if the internal name is Optima-Bold and the font is a
674 .pfa file called Optima-Bold.pfa, your updated download file will
675 contain
676 <br/>
677 <span class="pre-in-pp">
678 Optima-Bold&lt;tab&gt;Optima-Bold.pfa
679 </span>
680 </p>
681
682 <h4 id="gropdf-download" class="docs" style="font-size: 90%; text-transform: uppercase;">&nbsp;&bull;&nbsp;Updating the gropdf download file</h4>
683
684 <p class="top" style="margin-top: .5em;">
685 If you&#8217;re running a recent version of groff that includes
686 the native pdf device (gropdf), you must update the
687 <kbd class="nobr">&lt;prefix&gt;/site-font/devpdf/download</kbd>
688 file as well. If it does not exist, create it.
689 </p>
690
691 <div class="box-tip">
692 <p class="tip">
693 <span class="note">Note:</span>
694 Start with a blank &#8216;download&#8217; file. Do not copy
695 over the &#8216;download&#8217; file from
696 <kbd class="nobr">&lt;prefix&gt;/&lt;version&gt;/font/devpdf/</kbd>.
697 </p>
698 </div>
699
700 <p>
701 The instructions for registering fonts in the
702 <kbd class="nobr">&lt;prefix&gt;/site-font/devpdf/</kbd> download
703 file are identical to those for PostScript fonts (see above), but
704 with one important difference: the lines must all begin with a tab
705 character. Thus, using our Optima example, your
706 <kbd class="nobr">&lt;prefix&gt;/site-font/devpdf/download</kbd>
707 file download line for the same font is
708 <br/>
709 <span class="pre-in-pp">
710 &lt;tab&gt;Optima-Bold&lt;tab&gt;Optima-Bold.pfa
711 </span>
712 </p>
713
714 <h3 id="groff-font-names" class="docs appendices">Naming groff fonts</h3>
715
716 <p class="top">
717 For convenience when using mom, and to keep your font collection
718 organized, choose meaningful groff font names following the scheme
719 &lt;Family&gt;&lt;FONT&gt;, where Family is something
720 like Optima or Univers or Clarendon, and FONT is either
721 <br/>
722 <span style="display: block; margin-left: 2em;">
723 <kbd>R&nbsp;&nbsp;</kbd>(roman/regular)
724 <br/>
725 <kbd>I&nbsp;&nbsp;</kbd>(italic)
726 <br/>
727 <kbd>B&nbsp;&nbsp;</kbd>(bold)
728 <br/>
729 <kbd>BI&nbsp;</kbd>(bold italic)
730 </span>
731 or one of the 1&ndash;5 character fontstyles listed
732 <a href="#style-extensions">here</a>.
733 Thus, for the fonts Optima Light Italic and Optima Extra Black, your font names would be
734 <br/>
735 <span class="pre-in-pp">
736 OptimaLI
737 OptimaXBL
738 </span>
739 This scheme allows you to enter <kbd>.FAMILY&nbsp;Optima</kbd> to make
740 Optima the current family, and <kbd>.FT&nbsp;LI</kbd> or <kbd>.FT&nbsp;XBL</kbd>
741 when you need the fonts Light Italic or Extra Black.
742 </p>
743
744 <p>
745 Groff font names are, in fact, arbitrary; you can call your fonts
746 anything you like, provided the
747 <a href="#internal">internal name</a>
748 in the
749 <a href="#add">download file</a>
750 matches the internal name found in the groff font file. When
751 calling a font that does not follow the recommended naming convention,
752 you must pass the full font name to <kbd>.FT</kbd> whenever you wish
753 to use it.
754 </p>
755
756 <p>
757 For example, the font, Goudy Stout, isn&#8217;t really part of the
758 Goudy family, and while "stout" describes it, Stout is not a
759 recognized font style. Therefore, its groff name could simply be
760 GoudyStout, and whenever you needed it, you could call it with
761 <kbd>.FT&nbsp;GoudyStout</kbd>.
762 </p>
763
764 <h3 id="install-font" class="docs appendices">Automate the whole process &ndash; the install-font script</h3>
765
766 <p>
767 A bash script to make the entire process of installing fonts a
768 painless no-brainer has been posted online at
769 <a href="https://www.schaffter.ca/mom/bin/install-font.sh">https://www.schaffter.ca/mom/bin/install-font.sh</a>.
770 Be sure to make the script executable
771 (<kbd class="nobr">chmod 755 install-font</kbd>)
772 after you download it, then type <kbd>./install-font.sh -H</kbd> for
773 usage.
774 </p>
775
776 <div class="rule-medium" style="margin-top: 2em;"><hr/></div>
777
778 <!-- ===================================================================== -->
779
780 <h2 id="codenotes" class="docs">Some reflections on mom</h2>
781
782 <p>
783 If, as Eric Raymond asserts, open source begins with a programmer
784 scratching a personal itch, then mom can truly be called open
785 source.
786 </p>
787
788 <p>
789 Mom had her origins in a library of groff routines I wrote over
790 the years to handle various aspects of typesetting and document
791 processing that weren&#8217;t adequately covered by ms, me, mm, and
792 friends. Typically, I&#8217;d use the library to cobble together
793 macro sets for new challenges as they came my way.
794 </p>
795
796 <p>
797 As a writer living in a perpetual state of penury, all the computers
798 I&#8217;ve ever owned have been hand-me-downs&mdash;several
799 generations out-of-date and resource challenged. Disk space has
800 always been an issue, as has processor speed and available RAM. One
801 of the reasons I run GNU/Linux rather than the offering from Redmond
802 is that it has helped enormously to get the most out of my poor
803 little boxes.
804 </p>
805
806 <p>
807 In Linux-land (all Unix variants, in fact), the choice of
808 typesetting systems basically comes down to groff or TeX. Both are
809 wonderful&mdash;monumental achievements if you ask me&mdash;and both
810 have their own particular strengths. However, for people in my
811 financial position (and there are millions of us around the globe,
812 in both developed and developing countries), TeX and groff have one
813 big difference: size. TeX is huge. Even its most ardent supporters
814 agree it suffers from bloat, on top of being complex and unwieldy to
815 manage. Groff is tiny by comparison, occupying minimal disk space
816 and having only a small memory footprint while at the same time
817 being flexible and powerful, typographically speaking. Back in the
818 Jurassic Period, I ran it successfully on a 386 with 8 megs of RAM
819 and a 250 meg hard disk.
820 </p>
821
822 <p>
823 However, groff has always had a liability: it&#8217;s incredibly geeky.
824 Owing to its very long history, it&mdash;and its power users
825 &mdash;seem to have remained stuck in a time warp. The canonical macro packages
826 still look as they did back in those decades when memory was exorbitantly
827 expensive and every byte mattered.
828 </p>
829
830 <p>
831 For some time now, groff users and macro writers have had the option
832 to use &#8220;long&#8221; names for macros (i.e. longer than two
833 letters, the original limit), yet have mostly chosen not to. With
834 long names, it&#8217;s possible to create macro sets that are
835 humanly readable and easy to interpret, encouraging development and
836 evolution. What&#8217;s more, the macros themselves need not be
837 terse, intimidating, and easily forgotten 1- or 2-letter commands
838 inserted in the body of a document. They can be sensible and
839 helpful to everyone, groff newbies and old hands alike.
840 </p>
841
842 <p>
843 Mom&#8217;s macro file, om.tmac, uses long names, aliases, and a
844 host of other groff goodies that have become part of the whole groff
845 picture. The function of nearly every macro, number register and
846 string can be inferred simply from its name. The file is heavily
847 commented. A consistent, if idiosyncratic, indenting style is used
848 as well, significantly improving readability. Anyone wanting to
849 futz around with mom&#8217;s macros should be able to do so with a
850 minimum of head scratching.
851 </p>
852
853 <div class="rule-medium"><hr/></div>
854
855 <!-- ===================================================================== -->
856
857 <h2 id="contact" class="docs">Contact the author</h2>
858
859 <p>
860 If you have any questions or comments about mom, suggestions to
861 make, criticisms to offer, or bugs to report, use the groff mailing
862 list (subscription information available
863 <a href="http://www.gnu.org/software/groff/groff.html">here</a>)
864 or contact me, Peter Schaffter, directly at the following
865 address:
866 <br/>
867 <span class="pre-in-pp">
868 &#112;&#101;&#116;&#101;&#114;&#64;&#115;&#99;&#104;&#97;&#102;&#102;&#116;&#101;&#114;&#46;&#99;&#97;
869 </span>
870 Please include the word &#8220;mom&#8221; or &#8220;groff&#8221; in
871 the Subject line of any message sent to my personal address or you
872 risk the wrath of my implacable spam filters.
873 </p>
874
875 <p>
876 If you want to visit mom&#8217;s website, you&#8217;ll find a link
877 to it at
878 <br/>
879 <span class="pre-in-pp">
880 https://www.schaffter.ca
881 </span>
882 The site contains links to some of my fiction, all of which was
883 typeset with mom and groff.
884 </p>
885
886 <div class="rule-long"><hr/></div>
887
888 <!-- Navigation links -->
889 <table style="width: 100%; margin-top: 12px;">
890 <tr>
891 <td style="width: 33%;"><a href="toc.html">Back to Table of Contents</a></td>
892 <td style="width: 100%; text-align: right;"><a href="#top">Top</a></td>
893 </tr>
894 </table>
895
896 </div>
897
898 <div class="bottom-spacer"><br/></div>
899
900 </body>
901 </html>