summaryrefslogtreecommitdiff
path: root/contrib/mom/momdoc/appendices.html
blob: c2af13b8b972d58c70ff4515d47b911e0fe76a7e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
<?xml version="1.0" encoding="iso-8859-1"?>
<!--
This file is part of groff, the GNU roff type-setting system.

Copyright (C) 2004, 2005, 2006, 2009 Free Software Foundation, Inc.
Written by Peter Schaffter.

Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being this comment section, with no Front-Cover
Texts, and with no Back-Cover Texts.

A copy of the Free Documentation License is included as a file called
FDL in the main directory of the groff source package.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1"/>
<title>Mom -- Appendices</title>
</head>
<body bgcolor="#dfdfdf">

<!-- ==================================================================== -->

<a name="TOP"></a>

<p>
<a href="reserved.html#TOP">Next</a>&nbsp;&nbsp;
<a href="macrolist.html#TOP">Prev</a>&nbsp;&nbsp;
<a href="toc.html">Back to Table of Contents</a>
</p>

<a name="APPENDICES"><h2 align="center"><u>APPENDICES</u></h2></a>

<ul>
    <li><a href="#MOREDOC">Further notes on this documentation</a></li>
    <li><a href="#FONTS">Adding PostScript fonts to groff</a></li>
    <ul>
        <li><a href="#HOWTO">How to create a PostScript font for use with groff</a></li>
    </ul>
    <li><a href="#CODENOTES">Some reflections on mom, with an apology</a></li>
    <li><a href="#CONTACT">Contact the author</a></li>
    <li><a href="reserved.html">List of reserved words</a></li>
</ul>

<a name="MOREDOC"><h2><u>Further notes on this documentation</u></h2></a>

<p>
Some <strong>mom</strong> users are sure to ask: &quot;Why is this
documentation in html?  If <strong>mom</strong>'s so great, why not
typeset the whole thing to show her off?  And if groff's so great,
why not write a man page?&quot;
</p>

<p>
Valid questions, to be sure, and <strong>mom</strong> has
an answer.  (Okay &mdash; I have an answer, but I speak for
<strong>mom</strong>.)
</p>

<p>
The documentation is in html because I still find it the best tool
for navigating lengthy manuals.  Html, with its anchors and links,
came into being precisely so people could do something they'd never
been able to with the printed word: instantly track down internal
and external references in a document.
</p>

<p>
To me, it's essential that people reading <strong>mom</strong>'s
documentation never have difficulty finding precisely the macro
they need for a particular task.  Equally, when reading up on
a macro, they should never be presented with terms or other
macro names for which they cannot instantly find accurate explanations.
Short of having written the documentation in TeX for the info browser
(and TeX bloat is one of the reasons I prefer to typeset with groff),
I can think of no better way to achieve the kind of truly useful
documentation I wanted than html.
</p>

<hr/>

<!-- ===================================================================== -->

<a name="FONTS"><h2><u>Adding PostScript fonts to groff</u></h2></a>

<p>
Robert Valiant has set up a web page containing information,
instructions and strategies for adding PostScript and TrueType fonts
to <strong>groff</strong>.  The page is directed at Debian
GNU/Linux users, but knowledgable users of other GNU/Linux
distributions should have no difficulty adapting it to their needs.
The site is located at

<pre>
    <a href="http://russia.shaps.hawaii.edu/software/software.html">http://russia.shaps.hawaii.edu/software/software.html</a>
</pre>
</p>

<a name="SMALL_NOTE"></a>

<p>
<em><strong>Small note:</strong> the term</em>
<kbd>&lt;path_to_groff&gt;</kbd> <em>in this section refers to the
directory in which groff is installed, typically something
like</em> <kbd>/usr/share/groff/&lt;version&gt;</kbd> <em>(for
distro-specific, pre-compiled groff packages) or</em>
<kbd>/usr/local/share/groff/&lt;version&gt;</kbd> <em>(if you've
built groff from source).</em>
</p>

<p>
Groff comes with a small library of PostScript
<a href="definitions.html#TERMS_FAMILY">families</a>
(see the
<a href="typesetting.html#FAMILY">FAMILY</a>
macro for a list).  The families have four
<a href="definitions.html#TERMS_FONT">fonts</a>
associated with them.  These fonts are a combination of
<a href="definitions.html#TERMS_WEIGHT">weight</a>
and
<a href="definitions.html#TERMS_SHAPE">shape</a>:

<pre>
    <strong>R</strong>  (Roman, usually Medium weight),
    <strong>I</strong>  (Italic, usually Medium weight),
    <strong>B</strong>  (Bold, usually Roman shape) and
    <strong>BI</strong> (Bold Italic)
</pre>
</p>

<p>
If you do a lot of document processing or typesetting with
<strong>mom</strong>, you'll find, sooner or later, that these
families and their associated fonts aren't sufficient.  You'll want
to supplement them, either with more fonts for the families already
provided &mdash; &quot;Damn!  I need Helvetica Bold Condensed
Italic!&quot; &mdash; or with entire new families.
</p>

<p>
Without going into the gory details (yet), while it's true that
adding fonts to groff is a relatively straightforward
process, extending existing families or adding new ones requires
some planning.
</p>

<p>
The traditional approach to extending groff families has been
to create new families for non-default weights and
shapes (e.g.  Light, which is a weight; Condensed, which is a
shape), then to associate them with groff's predefined <strong>R,
I, B</strong> and <strong>BI</strong> font styles.  An example
of this can be seen in the groff PostScript font library itself
<nobr>(&lt;path_to_groff&gt;/font/devps/):</nobr> there's one
&quot;family&quot; for Helvetica (HR, HI, HB, HBI) and another for
Helvetica Narrow (HNR, HNI, HNB, HNBI).
</p>

<p>
The difficulty with this approach is that typographers
tend to think of &quot;families&quot; as referring to the
entire set of font weights and shapes associated with a
particular family name.  For example, when a typesetter says
&quot;the Helvetica family&quot;, s/he is including the
<a href="definitions.html#TERMS_WEIGHT">weights</a>
Helvetica Thin, Helvetic Light, Helvetica Regular, Helvetica Bold,
Helvetica Heavy, etc, and all their associated
<a href="definitions.html#TERMS_SHAPE">shapes</a>
(Roman, Italic, Condensed, Narrow, Extended, Outline, etc).
</p>

<p>
Thus, intuitively, when a typesetter gives <strong>mom</strong> a
<kbd>.FAM(ILY)</kbd> directive, s/he reasonably expects that any
subsequent <kbd>.FT</kbd> directive will access the desired font
from the Helvetica family &mdash; without the need to state explicitly both
family and font to <kbd>.FT</kbd>, as it is explained one can do in
the
<a href="typesetting.html#FAMILY">FAMILY</a>
and
<a href="typesetting.html#FONT">FT</a>
sections of these documents.
</p>

<p>
If one had, say, the fonts, Helvetica Light Roman and Helvetica
Light Italic as well as Helvetica Light Condensed Roman and
Helvetica Light Condensed Italic, the traditional approach would
require two &quot;partial&quot; families: HLR/HLI and HLCDR/HLCDI.
Accessing these family/font combos routinely throughout a document
would then require changing family (with <kbd>.FAM(ILY)</kbd>) and
selecting the desired font (with <nobr><kbd>.FT R</kbd></nobr>
or <nobr><kbd>.FT I</kbd>),</nobr> or passing <kbd>.FT</kbd> the
lengthy family+fontname (.e.g. <nobr><kbd>.FT HLCDI</kbd>).</nobr>
</p>

<p>
Fortunately, groff provides a mechanism whereby it's possible to
extend the basic <strong>R, I, B</strong> and <strong>BI</strong>
fonts (&quot;styles&quot; in groff-speak) so that one can, in
fact, create extensive type families, and access all the fonts
in them with <kbd>.ft</kbd> (groff) or <kbd>.FT</kbd> (mom).
</p>

<p>
<strong>Mom</strong> uses this mechanism to offer, in addition to
groff's default PostScript font styles, the following:

<a name="STYLE_EXTENSIONS"></a>

<pre>
Mom's extensions to groff's basic font styles
=============================================

    L      =  Light Roman
    LI     =  Light Italic
    LCD    =  Light Condensed Roman
    LCDI   =  Light Condensed Italic
    LEX    =  Light Extended Roman
    LEXI   =  Light Extended Italic
    CD     =  Medium/Book Condensed Roman
    CDI    =  Medium/Book Condensed Italic
    EX     =  Medium/Book Extended Roman
    EXI    =  Medium/Book Extended Italic
    DB     =  DemiBold Roman
    DBI    =  DemiBold Italic
    BCD    =  Bold Condensed Roman
    BCDI   =  Bold Condensed Italic
    BEX    =  Bold Extended Roman
    BEXI   =  Bold Extended Italic
    HV     =  Heavy Roman
    HVI    =  Heavy Italic
    HVCD   =  Heavy Condensed Roman
    HVCDI  =  Heavy Condensed Italic
    HVEX   =  Heavy Extended Roman
    HVEXI  =  Heavy Extended Italic
    BL     =  Black Roman
    BLI    =  Black Italic
    BLCD   =  Black Condensed Roman
    BLCDI  =  Black Condensed Italic
    BLEX   =  Black Extended Roman
    BLEXI  =  Black Extended Italic
    UBL    =  Ultra-Black Roman
    UBLI   =  Ultra-Black Italic
</pre>
</p>

<p>
Thus, with <strong>mom</strong>, if you've installed, say, some
extra Helvetica fonts and named them according to the convention FS
(where &quot;F&quot; means family and &quot;S&quot; means font
style), once having entered

<pre>
    .FAMILY H
      or
    .FAM H
</pre>

you can access any of those Helvetica fonts simply by
passing the correct argument from the list above to
<a href="typesetting.html#FONT">FT</a>.
</p>

<p>
For example, if you were working in Medium Roman
<nobr>(<kbd>.FT R</kbd>)</nobr> and you needed Medium Condensed
Italic for a while (assuming it's installed), you'd just type

<pre>
    .FT CDI
</pre>

to access the Medium Condensed Italic font from the Helvetica
family.
</p>

<p>
<strong>Mom</strong>'s list of font styles doesn't pretend to
be exhaustive, but rather tries to cover the basic weight/shape
combinations likely to be found in any reasonably complete type
family.
</p>

<p>
The actual extension names are arbitrary and can be used in a
flexible manner.  For example, if you create a family that has a
DemiBold font (DB) but no Bold font (B), you might find it more
convenient to give the DemiBold font the extension &quot;B&quot;.
Equally, if the family has an ExtraBold font, you might find it more
convenient to use the extension &quot;HV&quot; (Heavy).
</p>

<a name="REGISTER_STYLE"></a>

<p>
However, you may, at needs, want to add to <strong>mom</strong>'s
list of font styles.  You can do this by editing the file, om.tmac.
Near the top, you'll see lines of the form

<pre>
    .sty \n[.fp] L       \" Light Roman
    .sty \n[.fp] LI      \" Light Italic
    .sty \n[.fp] LCD     \" Light Condensed Roman
</pre>
</p>

<p>
Simply add your new font style by imitating what you see and
plugging in your new font style (having, of course, first created the
font, correctly named, in groff's PostScript font directory; see
<a href="#HOWTO">How to create a PostScript font for use with groff</a>).
</p>

<p>
For example, if you already have some fonts from the Univers
family installed and have called the family <strong>UN</strong>,
you might decide at some point to add the Bold Outline font
(<strong>UNBO</strong>).  In which case, you'd add

<pre>
    .sty \n[.fp] BO      \" Bold Outline
</pre>

to the <nobr><kbd>.sty \n[.fp] &lt;font style&gt;</kbd></nobr> list
in om.tmac.
</p>

<p>
Be careful, though, that any styles you add do not conflict
with <strong><u>family</u></strong> names that already exist.
&quot;C&quot;, for example, conflicts with the Courier family
(<strong>CR, CI, CB, CBI</strong>).  Were you to create a font
style &quot;C&quot;, thinking that <nobr><kbd>.FT C</kbd></nobr>
would give you access to font style once you'd given a
<kbd>.FAM(ILY)</kbd> directive, you'd get a nasty surprise: your
type would come out in Courier Roman!
</p>

<p>
<strong>VERY IMPORTANT NOTE: mom</strong>'s font extensions are
not &quot;user-space&quot; controllable via a macro.  If you've
been using groff for a long time and have already rolled your own
solution to adding PostScript families, fonts, weights, shapes, etc. to
groff, you may find that <strong>mom</strong>'s font extensions
conflict with your own scheme.  Should that be the case, comment out
the <nobr><kbd>.sty \n[.fp] &lt;font style&gt;</kbd></nobr> lines
found near the top of the <kbd>om.tmac</kbd> file.
</p>

<a name="HOWTO"><h3><u>How to create a PostScript font for use with groff</u></h3></a>

<p>
These instructions aren't meant to cover all possibilities, merely
to present one way of making PostScript families/fonts available to
groff and <strong>mom</strong>.
</p>

<p>
GNU/Linux distributions being what they are, directory locations may
differ and the presence of some executables can't be guaranteed.
I run a Debian system.  The instructions reflect that.  Users of
other distros will have to interpret them according to the way their
distro operates.
</p>

<h4><u>What you need before you start</u>:</h4>

<ul>
    <li>groff, version 1.18 or higher
        <br/>

        (Debian package: groff)
    </li>
    <li>a full installation of gs and associated tools
        <br/>

        (Debian package: gs or gs-gpl or gs-esp or gs-afpl)
    </li>
    <li>a library of gs fonts
        <br/>

        (Debian package: gsfonts)
    </li>
    <li>a utility for converting TrueType fonts to Type1 fonts
        <br/>

        (Debian package: ttf2pt1)
    </li>
    <li>a font manager
        <br/>

        (Debian packages: defoma, psfontmgr)
    </li>
    <li>perl
        <br/>

        (Debian package: perl)
     </li>
</ul>

<p>
A reasonably complete installation of any major GNU/Linux distro
should already have these on your system, except perhaps for the
utility to convert TrueType fonts to Type1 fonts.
</p>

<h4><u>Initial preparation (you only have to do this once)</u>:</h4>

<ol>
    <li>If you don't already have one, create a directory in your
        home directory to hold new fonts.  Any directory name will do.
        I use <kbd>~/Fonts</kbd>, with subdirectories for Type1,
        TrueType and Groff fonts.
    </li>
<a name="SITE-FONT"></a>
    <li>Locate the groff directory, site-font.  The exact location is
        difficult to predict, owing to differences between distros
        and whether you're using a pre-packaged groff or have built
        it from source.  Some typical locations are
        <br/><br/>

        <ul>
            <li><kbd>/usr/share/groff</kbd></li>
            <li><kbd>/usr/local/share/groff</kbd></li>
            <li><kbd>/etc/groff</kbd></li>
        </ul>
        <br/>

        If you can't find the site-font directory, locate
        groff's site-tmac directory, and, as root, create site-font
        in the same directory as the one that holds site-tmac.
        E.g., if you find site-tmac in <kbd>/usr/share/groff</kbd>,
        create site-font in <kbd>/usr/share/groff</kbd>.
    </li>
    <li>Locate the file <kbd>&lt;path_to_groff&gt;/font/devps/generate/textmap</kbd>
        and symlink it to <kbd>textmap</kbd> in the directory that
        contains your personal collection of PostScript fonts.  (See the
        <a href="#SMALL_NOTE">Small Note</a>,
        above, for the meaning of
        <nobr><kbd>&lt;path_to_groff&gt;</kbd>).</nobr>  On my system,
        at the time of writing, <kbd>&lt;path_to_groff&gt;</kbd> is
        <nobr><kbd>/usr/local/share/groff/1.19.2/</kbd>,</nobr>
        therefore, I symlink it in <kbd>~/Fonts/Type1</kbd> with

        <pre>
<kbd>ln -s /usr/local/share/groff/1.19.2/font/devps/generate/textmap textmap</kbd>
        </pre>
    </li>
    <li>Locate the file <kbd>&lt;path_to_groff&gt;/font/devps/text.enc</kbd> and
        symlink it to <kbd>text.enc</kbd> in your personal font
        directory.  On my system, in <kbd>~/Fonts/Type1</kbd>

        <pre>
ln -s /usr/local/share/groff/1.19.2/font/devps/text.enc text.enc
        </pre>
    </li>
    <li>Make sure you know which directory/ies holds your gs fonts.
        You'll need the information later.  On a Debian box, some
        typical locations are
        <br/><br/>
        <ul>
            <li><kbd>/usr/lib/ghostscript/fonts</kbd></li>
            <li><kbd>/usr/share/ghostscript/fonts</kbd></li>
            <li><kbd>/usr/share/fonts/type1/gsfonts</kbd></li>
        </ul></li>
</ol>

<h4><u>Font creation/installation</u>:</h4>

<ol>
    <li>Acquire the font in either Type1 (.pfb) or TrueType (.ttf) format.</li>
    <li>Place the font in your personal font directory; for me,
        that's <kbd>~/Fonts/Type1</kbd> or <kbd>~/Fonts/TrueType.</kbd>
    </li>
    <li>In your personal font directory, run one of the following:</li>
    <ul>
        <li>For Type1 fonts</li>
        <ul>
            <li><kbd>getafm fontfilename.pfb | gsnd - > fontfilename.afm</kbd>
                <br/>

                <em>For Type1 fonts, this will generate something called
                an .afm (Adobe Font Metrics) file, which is
                required to create PostScript fonts for groff.</em>
            </li>
        </ul>
        <li>For TrueType fonts</li>
        <ul>
            <li><kbd>ttf2pt1 \-b fontfilename.ttf</kbd>
                <br/>
                <em>For TrueType fonts, this will generate a PostScript
                .pfb file as well as an .afm file.</em>
            </li>
        </ul>
    </ul>
    <li>Still in your personal font directory, run</li>
    <ul>
        <li><kbd>afmtodit -e text.enc fontfilename.afm textmap GROFF_FONTNAME</kbd>
            <br/><br/>

            Q: <em>How do I choose a GROFF_FONTNAME?</em>
            <br/><br/>

            A: Start by considering the
            <a href="definitions.html#TERMS_FAMILY">family</a>
            to which the font belongs.  If you're adding to a family that
            already exists in groff's <kbd>&lt;path_to_groff&gt;/font/devps</kbd>
            directory, that will be the first part of the font name.  (See
            <a href="typesetting.html#FAMILY">here</a>
            for a list of families already installed, along with their groff
            names.)  Add to that name the appropriate weight/style extension,
            listed
            <a href="#STYLE_EXTENSIONS">here</a>.
            <br/><br/>
    
            For example, if you're adding Helvetica Light Roman, your
            GROFF_FONTNAME would be <kbd>HL</kbd>.  If you're adding
            Helvetica Light Italic, your GROFF_FONTNAME would be
            <kbd>HLI</kbd>.
            <br/><br/>
    
            If you're adding a font not already in groff's PostScript
            families, first choose a meaningful name for the
            <a name="definitions.html#TERMS_FAMILY">family</a>
            to which the font belongs.  The name can be anything you
            like.  If, for example, the family is Garamond, you could
            choose GARAMOND, GARA, GD, or even just plain G as the
            family name.  Then tack on the appropriate style/weight
            extension.  Thus, if you were installing Garamond Bold
            Condensed Italic and had chosen <kbd>GD</kbd> as the family
            name for Garamond, your GROFF_FONTNAME would be
            <kbd>GDBCDI</kbd>.
            <br/><br/>
    
            In <strong>mom</strong>, you can then access the Garamond
            family with <kbd>.FAM GD</kbd>, and the Bold Condensed
            Italic font wth <kbd>.FT BCDI</kbd>.
            <br/><br/>
    
            <strong>Note:</strong> The family name need not be in upper
            case, and there's no limit to the length of the name.
            &quot;Garamond&quot;, for example, could be the name you
            give the Garamond family.  In fact, you might find it
            preferable, since a) you wouldn't have to remember how
            you'd named the family, and b) should you be scanning
            your
            <a href="#SITE-FONT">site-font directory</a>,
            something like GaramondBCDI will be more meaningful than,
            say, <strong>GDBCDI</strong>.
        </li>
    </ul>
    <li>Copy or move GROFF_FONTNAME to your
        <a href="#SITE-FONT">site-font directory</a>,
        or change to the site-font directory and make a symlink to
        GROFF_FONTNAME in your personal directory.
    </li>
    <li>Copy or move the .pfb file to the directory that
        holds your gs fonts, or change to that directory and make a
        symlink to the .pfb file in your personal directory.
    </li>
</ol>

<p>
Written out in full, adding fonts looks like a lot of work.  It
isn't.  Basically, it's just:

<ul>
    <li>acquire the font</li>
    <li>generate an .afm file for the font</li>
    <li>create the groff font</li>
    <li>put the groff font in<kbd> &lt;path_to_groff&gt;/font/devps</kbd>
        and the .pfb in your gs font directory
    </li>
</ul>
</p>

<p>
After you've done it a couple of times, it all makes sense, and
is really quite easy.  Not to mention that once you understand
the process, you can write a bash script to automate the process.
Here's a rudimentary example, which you can adapt to your own needs.
The script requires an argument (the .pfb filename), then prompts
for the GROFF_FONTNAME.
</p>

<pre>
#!/bin/sh
#
# Converts .ttf files to .pfb and generates .afm
# Moves the .afm and .pfb to $HOME/Fonts/Type1
# Generates a groff font from the .afm file and installs it in $HOME/Fonts/Groff
# Symlinks the font in <path to groff font/devps>
# Symlinks the .afm and .pfb in /usr/lib/ghostscript/font/
#

FONT=`basename $1 .ttf`
FONTDIR="$HOME/Fonts/TrueType"
T1_FONTDIR="$HOME/Fonts/Type1"
GS_FONTDIR="/usr/share/fonts/type1/gsfonts"
GROFF_SITE_FONTDIR="/usr/local/share/groff/site-font/devps"
GROFF_FONTS="$HOME/Fonts/Groff"
TEXTMAP="$T1_FONTDIR/textmap"
TEXTENC="$T1_FONTDIR/text.enc"

echo -n "Family directory name: "
read FAMILYDIR

if [ ! -d "$T1_FONTDIR/$FAMILYDIR" ] ; then
    echo "Creating $FAMILYDIR in $T1_FONTDIR"
    mkdir $T1_FONTDIR/$FAMILYDIR
fi

echo -n "Groff name for this font: "
read FONTNAME

echo "Creating .pfb and .afm files from $FONT.ttf"
(ttf2pt1 \-b $FONT.ttf)

echo "Moving .afm and .pfb file to $T1_FONTDIR/$FAMILYDIR.."
mv $FONT.afm $T1_FONTDIR/$FAMILYDIR
mv $FONT.pfb $T1_FONTDIR/$FAMILYDIR

echo "Changing to $T1_FONTDIR/$FAMILYDIR.."
cd $T1_FONTDIR/$FAMILYDIR

echo "Creating $FONTNAME.."
afmtodit -e $TEXTENC $T1_FONTDIR/$FAMILYDIR/$FONT.afm $TEXTMAP $FONTNAME
mv -i $FONTNAME $GROFF_FONTS
echo "Linking $FONTNAME in $GROFF_SITE_FONTDIR.."
sudo ln -s $GROFF_FONTS/$FONTNAME $GROFF_SITE_FONTDIR/$FONTNAME

echo "Linking $FONT.pfb and $FONT.afm in $GS_FONTDIR.."
cd $GS_FONTDIR
sudo ln -s $T1_FONTDIR/$FAMILYDIR/$FONT.afm $FONT.afm
sudo ln -s $T1_FONTDIR/$FAMILYDIR/$FONT.pfb $FONT.pfb

echo "Font installation complete"

exit 0
</pre>

<hr/>

<!-- ===================================================================== -->

<a name="CODENOTES"><h2><u>Some reflections on mom</u></h2></a>

<p>
<strong>Mom</strong>, as a complete macro set, had her origins
in a &quot;library&quot; of groff routines I wrote over the
years to handle various aspects of typesetting and document
processing that weren't adequately covered by ms, me, mm, and so
on.  Typically, I'd use the library to cobble together macro
sets for new challenges as they came my way.
</p>

<p>
If, as Eric Raymond asserts, open source begins with a programmer
scratching a personal itch, then <strong>mom</strong> can truly be
called open source, even if, a mere humble set of macros standing on
the shoulders of a giant named troff, she isn't programming at all.
</p>

<p>
As a writer living in a perpetual state of penury, all the computers
I've ever owned have been hand-me-downs &mdash; several generations
out-of-date and &quot;resource challenged&quot;.  Disk space has
always been an issue, as has processor speed and available RAM.
One of the reasons I run GNU/Linux is that it has helped enormously
to get the most out of my poor little boxes.  (It has been pointed
out to me that NetBSD might be an even better choice of operating
systems for computers with limited resources.)
</p>

<p>
In Linux-land, the choice of typesetting systems basically comes down
to groff or TeX.  Both are wonderful &mdash; monumental achievements if you
ask me &mdash; and both have their own particular strengths.  However, for
people in my financial position (and there are millions of us around
the globe, in both developed and developing countries), TeX and groff
have one big difference: size.  TeX is huge.  Even its most ardent
supporters agree it suffers from bloat, on top of being complex and
unwieldy to manage.  Groff is tiny by comparison, occupying minimal
disk space and having only a small memory footprint while at the same
time being flexible and powerful, typographically speaking.  I've run
it successfully on a 386 with 8 megs of RAM and a 250 meg hard disk.
</p>

<p>
However, groff has always had a liability: it's incredibly geeky.
Owing to its very long history, it &mdash; and its &quot;power users&quot;
&mdash; have remained stuck in a time warp.  Most common macro packages
still look as they did in those decades when memory was exorbitantly
expensive and every byte mattered.  Documentation &mdash; not always
easy to find &mdash; is written as if all readers are computer whizzes,
or at least have a university degree in one of the higher sciences.
</p>

<p>
By no means a stupid man, nor unfamiliar with the precepts of
programming, I've more than once torn my hair out over the terseness
and ambiguity of groff's documentation.  Making sense of certain
primitives has often involved days of testing, interpreting the
documentation instead of just using the primitive.
</p>

<p>
(ADDENDUM to the previous two paragraphs:  A tremendous amount of
effort has gone into creating a groff manual that can be read with
the <strong><kbd>info</kbd></strong> browser, as well as creating
truly useful man pages.  The <strong><kbd>info</kbd></strong> manual
is clear and well-written, so my comments are actually out of date.
I leave them in for the benefit of groff newbies, who may still find
the documents a bit intimidating.)
</p>

<p>
For some time now, groff users and macro writers have had the
option to use &quot;long&quot; names, yet have mostly chosen not to.
With long names, it's possible to create macro sets that are humanly
readable and easy to interpret, encouraging development and evolution.
What's more, the macros themselves need not be terse, intimidating,
and easily forgotten 1- or 2-letter commands inserted in the body
of a document.  They can be sensible and helpful to everyone, groff
newbies and old hands alike.
</p>

<p>
<strong>Mom</strong>'s macro file, om.tmac, uses long names, aliases,
and a host of other groff goodies that have become part of the
whole groff picture under the unflagging guidance of groff's current
maintainer, Werner Lemberg.  Nearly every macro, number register and
string is &quot;recognisable&quot; simply by its name.  The file is
heavily commented.  A consistent, if idiosyncratic, indenting style
is used as well, significantly improving readability.  Anyone
wanting to futz around with <strong>mom</strong>'s macros should be
able to do so with a minimum of head scratching.
</p>

<p>
<strong>Addendum</strong> As of version 1.4-a, the main macro
file, om.tmac, is now stripped of comments when groff is built
from sources.  om.tmac in the sources themselves still contains the
comments, as do the tarballs posted on <strong>mom</strong>'s
homepage.
</p>

<hr/>

<!-- ===================================================================== -->

<a name="CONTACT"><h2><u>Contact the author</u></h2></a>

<p>
If you have any questions or comments about <strong>mom</strong>,
suggestions to make, criticisms to offer, or bugs to report, use the
groff mailing list at
<a href="mailto:groff@ffii.org">groff@ffii.org</a>
(subscription information available
<a href="http://ffii.org/mailman/listinfo/groff/">here</a>)
or contact me, Peter Schaffter,  directly at of the following
address:
</p>

<p>
<strong><i>&#112;&#115;&#99;&#104;&#97;&#102;&#102;&#116;&#101;&#114;&#64;&#110;&#99;&#102;&#46;&#99;&#97;
</i></strong>
</p>

<p>
Please include the word &quot;mom&quot; or &quot;groff&quot; in the
Subject: line of any message sent to my personal address, or you
risk the wrath of my implacable spam filters. :)
</p>

<p>
If you want to visit <strong>mom</strong>'s homepage, you'll find
it at
</p>

<p>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://web.ncf.ca/fs222/mom/mom-01.html"><kbd>http://web.ncf.ca/fs222/mom/mom-01.html</kbd></a>.
</p>

<hr/>

<p>
<a href="reserved.html#TOP">Next</a>&nbsp;&nbsp;
<a href="macrolist.html#TOP">Prev</a>&nbsp;&nbsp;
<a href="#TOP">Top</a>&nbsp;&nbsp;
<a href="toc.html">Back to Table of Contents</a>
</p>

</body>
</html>

<!-- vim: fileencoding=latin1: nomodified:
-->