appendices.html revision 1.1 1 1.1 christos <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
2 1.1 christos <html>
3 1.1 christos <head>
4 1.1 christos <meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
5 1.1 christos <title>Mom -- Appendices</title>
6 1.1 christos </head>
7 1.1 christos <body bgcolor="#dfdfdf">
8 1.1 christos
9 1.1 christos <!====================================================================>
10 1.1 christos
11 1.1 christos <a href="reserved.html#TOP">Next</a>
12 1.1 christos <a href="macrolist.html#TOP">Prev</a>
13 1.1 christos <a href="toc.html">Back to Table of Contents</a>
14 1.1 christos <p>
15 1.1 christos
16 1.1 christos <a name="TOP"></a>
17 1.1 christos <a name="APPENDICES">
18 1.1 christos <h2 align="center"><u>APPENDICES</u></h2>
19 1.1 christos </a>
20 1.1 christos
21 1.1 christos <ul>
22 1.1 christos <li><a href="#MOREDOC">Further notes on this documentation</a>
23 1.1 christos <li><a href="#FONTS">Adding PostScript fonts to groff</a>
24 1.1 christos <ul>
25 1.1 christos <li><a href="#HOWTO">How to create a PostScript font for use with groff</a>
26 1.1 christos </ul>
27 1.1 christos <li><a href="#CODENOTES">Some reflections on mom, with an apology</a>
28 1.1 christos <li><a href="#CONTACT">Contact the author</a>
29 1.1 christos <li><a href="reserved.html">List of reserved words</a>
30 1.1 christos </ul>
31 1.1 christos
32 1.1 christos <a name="MOREDOC">
33 1.1 christos <h2><u>Further notes on this documentation</u></h2>
34 1.1 christos </a>
35 1.1 christos
36 1.1 christos Some <strong>mom</strong> users are sure to ask: "Why is this
37 1.1 christos documentation in html? If <strong>mom</strong>'s so great, why not
38 1.1 christos typeset the whole thing to show her off? And if groff's so great,
39 1.1 christos why not write a man page?"
40 1.1 christos <p>
41 1.1 christos Valid questions, to be sure, and <strong>mom</strong> has
42 1.1 christos answers. (Okay -- I have answers, but I speak for
43 1.1 christos <strong>mom</strong>.)
44 1.1 christos <p>
45 1.1 christos The documentation is in html because I still find it the best tool
46 1.1 christos for navigating lengthy manuals. Html, with its anchors and links,
47 1.1 christos came into being precisely so people could do something they'd never
48 1.1 christos been able to with the printed word: instantly track down internal
49 1.1 christos and external references in a document.
50 1.1 christos <p>
51 1.1 christos To me, it's essential that people reading <strong>mom</strong>'s
52 1.1 christos documentation never have difficulty finding precisely the macro
53 1.1 christos they need for a particular task. Equally, when reading up on
54 1.1 christos a macro, they should never be presented with terms or other
55 1.1 christos macro names for which they cannot instantly find accurate explanations.
56 1.1 christos Short of having written the documentation in TeX for the info browser
57 1.1 christos (and TeX bloat is one of the reasons I prefer to typeset with groff),
58 1.1 christos I can think of no better way to achieve the kind of truly useful
59 1.1 christos documentation I wanted than html.
60 1.1 christos <p>
61 1.1 christos Another reason for html is that working with <strong>mom</strong>
62 1.1 christos necessarily involves creating files inside a text editor. I use
63 1.1 christos elvis, a truly fabulous vi clone that does a terrific job of rendering
64 1.1 christos basic (text only) html. I may have written <strong>mom</strong>,
65 1.1 christos but I still regularly call on her documentation. Elvis, with its
66 1.1 christos html capabilities, lets me write and format <strong>mom</strong>
67 1.1 christos documents AND peruse her documentation, clicking on links as
68 1.1 christos necessary, without ever leaving the comfy confines of my
69 1.1 christos text editor.
70 1.1 christos <p>
71 1.1 christos Not everyone, of course, uses an editor with html capabilities.
72 1.1 christos For them, firing up a browser is obviously necessary for reading
73 1.1 christos <strong>mom</strong>'s documentation. Browsers being what they are,
74 1.1 christos and not everyone on the globe having the cash for muscle machines
75 1.1 christos to run Galeon, or Konqueror or Mozilla, their browser
76 1.1 christos needs to be fast and light--and probably "text-only".
77 1.1 christos <p>
78 1.1 christos Some <strong>mom</strong> users may notice the absence of graphics,
79 1.1 christos frames, and (for the most part) tables in this documentation. The
80 1.1 christos reason is simple: text-only browsers. People who, for whatever
81 1.1 christos reason (choice or necessity), use lynx, or links or w3m to read
82 1.1 christos the documentation must be able to make sense of it. All of it.
83 1.1 christos Graphical examples of <strong>mom</strong> in action might have made
84 1.1 christos some parts of the documentation easier to write, but would have
85 1.1 christos excluded text-only browser users. And it goes without saying that
86 1.1 christos the documentation looks fine if you're reading it in a graphical
87 1.1 christos browser.
88 1.1 christos <br>
89 1.1 christos <hr>
90 1.1 christos
91 1.1 christos <!=====================================================================>
92 1.1 christos
93 1.1 christos <a name="FONTS">
94 1.1 christos <h2><u>Adding PostScript fonts to groff</u></h2>
95 1.1 christos </a>
96 1.1 christos
97 1.1 christos <a name="SMALL_NOTE"></a>
98 1.1 christos <em><strong>Small note:</strong> the term <prefix> in this
99 1.1 christos section refers to the directory in which groff is installed,
100 1.1 christos typically something like /usr/share/groff/<version#>
101 1.1 christos (for distro-specific, pre-compiled groff packages) or
102 1.1 christos /usr/local/share/groff/<version#> (if you've built groff
103 1.1 christos from source).</em>
104 1.1 christos <p>
105 1.1 christos Groff comes with a small library of PostScript
106 1.1 christos <a href="definitions.html#TERMS_FAMILY">families</a>
107 1.1 christos (see the
108 1.1 christos <a href="typesetting.html#FAMILY">FAMILY</a>
109 1.1 christos macro for a list). The families have four
110 1.1 christos <a href="definitions.html#TERMS_FONT">fonts</a>
111 1.1 christos associated with them. These fonts are a combination of
112 1.1 christos <a href="definitions.html#TERMS_WEIGHT">weight</a>
113 1.1 christos and
114 1.1 christos <a href="definitions.html#TERMS_SHAPE">shape</a>:
115 1.1 christos <br>
116 1.1 christos <ul>
117 1.1 christos <li><strong>R</strong> (Roman, usually Medium weight),
118 1.1 christos <li><strong>I</strong> (Italic, usually Medium weight),
119 1.1 christos <li><strong>B</strong> (Bold, usually Roman shape) and
120 1.1 christos <li><strong>BI</strong> (Bold Italic).
121 1.1 christos </ul>
122 1.1 christos <p>
123 1.1 christos If you do a lot of document processing or typesetting with
124 1.1 christos <strong>mom</strong>, you'll find, sooner or later, that these
125 1.1 christos families and their associated fonts aren't sufficient. You'll want
126 1.1 christos to supplement them, either with more fonts for the families already
127 1.1 christos provided--"Damn! I need Helvetica Bold Condensed Italic!"--or with
128 1.1 christos entire new families.
129 1.1 christos <p>
130 1.1 christos Without going into the gory details (yet), while it's true that
131 1.1 christos adding fonts to groff is a relatively straightforward
132 1.1 christos process, extending existing families or adding new ones requires
133 1.1 christos some planning.
134 1.1 christos <p>
135 1.1 christos The traditional approach to extending groff families has been
136 1.1 christos to create new families for non-default weights and
137 1.1 christos shapes (e.g. Light, which is a weight; Condensed, which is a
138 1.1 christos shape), then to associate them with groff's predefined <strong>R,
139 1.1 christos I, B</strong> and <strong>BI</strong> font styles. An example
140 1.1 christos of this can be seen in the groff PostScript font library itself
141 1.1 christos (<prefix>/font/devps/): there's one "family" for
142 1.1 christos Helvetica (HR, HI, HB, HBI) and another for Helvetica Narrow (HNR,
143 1.1 christos HNI, HNB, HNBI).
144 1.1 christos <p>
145 1.1 christos The difficulty with this approach is that typographers
146 1.1 christos tend to think of "families" as referring to the
147 1.1 christos entire set of font weights and shapes associated with a
148 1.1 christos particular family name. For example, when a typesetter says
149 1.1 christos "the Helvetica family", s/he is including the <a
150 1.1 christos href="definitions.html#TERMS_WEIGHT">weights</a> Helvetica Thin,
151 1.1 christos Helvetic Light, Helvetica Regular, Helvetica Bold, Helvetica Heavy,
152 1.1 christos etc, and all their associated
153 1.1 christos <a href="definitions.html#TERMS_SHAPE">shapes</a>
154 1.1 christos (Roman,
155 1.1 christos Italic, Condensed, Narrow, Extended, Outline, etc).
156 1.1 christos <p>
157 1.1 christos Thus, intuitively, when a typesetter gives <strong>mom</strong> a
158 1.1 christos <kbd>.FAM(ILY)</kbd> directive, s/he reasonably expects that any
159 1.1 christos subsequent <kbd>.FT</kbd> directive will access the desired font
160 1.1 christos from the Helvetica family--without the need to state explicitly both
161 1.1 christos family and font to <kbd>.FT</kbd>, as it is explained one can do in
162 1.1 christos the
163 1.1 christos <a href="typesetting.html#FAMILY">FAMILY</a>
164 1.1 christos and
165 1.1 christos <a href="typesetting.html#FONT">FT</a>
166 1.1 christos sections of these documents.
167 1.1 christos <p>
168 1.1 christos If one had, say, the fonts, Helvetica Light Roman
169 1.1 christos and Helvetica Light Italic as well as Helvetica Light Condensed
170 1.1 christos Roman and Helvetica Light Condensed Italic, the traditional
171 1.1 christos approach would require two "partial" families: HLR/HLI and
172 1.1 christos HLCDR/HLCDI. Accessing these family/font combos
173 1.1 christos routinely throughout a document would then require
174 1.1 christos changing family (with <kbd>.FAM(ILY)</kbd>) and selecting the
175 1.1 christos desired font (with <kbd>.FT R</kbd> or <kbd>.FT I</kbd>), or
176 1.1 christos passing <kbd>.FT</kbd> the lengthy family+fontname (.e.g. <kbd>.FT
177 1.1 christos HLCDI</kbd>).
178 1.1 christos <p>
179 1.1 christos Fortunately, groff provides a mechanism whereby it's possible to
180 1.1 christos extend the basic <strong>R, I, B</strong> and <strong>BI</strong>
181 1.1 christos fonts ("styles" in groff-speak) so that one can, in
182 1.1 christos fact, create extensive type families, and access all the fonts
183 1.1 christos in them with <kbd>.ft</kbd> (groff) or <kbd>.FT</kbd> (mom).
184 1.1 christos <p>
185 1.1 christos <strong>mom</strong> uses this mechanism to offer, in addition to
186 1.1 christos groff's default PostScript font styles, the following:
187 1.1 christos <p>
188 1.1 christos <a name="STYLE_EXTENSIONS"></a>
189 1.1 christos <pre>
190 1.1 christos Mom's extensions to groff's basic font styles
191 1.1 christos =============================================
192 1.1 christos
193 1.1 christos L = Light Roman
194 1.1 christos LI = Light Italic
195 1.1 christos LCD = Light Condensed Roman
196 1.1 christos LCDI = Light Condensed Italic
197 1.1 christos LEX = Light Extended Roman
198 1.1 christos LEXI = Light Extended Italic
199 1.1 christos CD = Medium/Book Condensed Roman
200 1.1 christos CDI = Medium/Book Condensed Italic
201 1.1 christos EX = Medium/Book Extended Roman
202 1.1 christos EXI = Medium/Book Extended Italic
203 1.1 christos DB = DemiBold Roman
204 1.1 christos DBI = DemiBold Italic
205 1.1 christos BCD = Bold Condensed Roman
206 1.1 christos BCDI = Bold Condensed Italic
207 1.1 christos BEX = Bold Extended Roman
208 1.1 christos BEXI = Bold Extended Italic
209 1.1 christos HV = Heavy Roman
210 1.1 christos HVI = Heavy Italic
211 1.1 christos HVCD = Heavy Condensed Roman
212 1.1 christos HVCDI = Heavy Condensed Italic
213 1.1 christos HVEX = Heavy Extended Roman
214 1.1 christos HVEXI = Heavy Extended Italic
215 1.1 christos BL = Black Roman
216 1.1 christos BLI = Black Italic
217 1.1 christos BLCD = Black Condensed Roman
218 1.1 christos BLCDI = Black Condensed Italic
219 1.1 christos BLEX = Black Extended Roman
220 1.1 christos BLEXI = Black Extended Italic
221 1.1 christos UBL = Ultra-Black Roman
222 1.1 christos UBLI = Ultra-Black Italic
223 1.1 christos </pre>
224 1.1 christos
225 1.1 christos Thus, with <strong>mom</strong>, if you've installed, say, some
226 1.1 christos extra Helvetica fonts and named them according to the convention FS
227 1.1 christos (where "F" means family and "S" means font
228 1.1 christos style), once having entered
229 1.1 christos <p>
230 1.1 christos <pre>
231 1.1 christos .FAMILY H
232 1.1 christos or
233 1.1 christos .FAM H
234 1.1 christos </pre>
235 1.1 christos
236 1.1 christos you can access any of those Helvetica fonts simply by
237 1.1 christos passing the correct argument from the list above to
238 1.1 christos <a href="typesetting.html#FONT">FT</a>.
239 1.1 christos <p>
240 1.1 christos For example, if you were working in Medium Roman (<kbd>.FT R</kbd>)
241 1.1 christos and you needed Medium Condensed Italic for a while (assuming it's
242 1.1 christos installed), you'd just type
243 1.1 christos <p>
244 1.1 christos <pre>
245 1.1 christos .FT CDI
246 1.1 christos </pre>
247 1.1 christos
248 1.1 christos to access the Medium Condensed Italic font from the Helvetica
249 1.1 christos family.
250 1.1 christos <p>
251 1.1 christos <strong>Mom</strong>'s list of font styles doesn't pretend to
252 1.1 christos be exhaustive, but rather tries to cover the basic weight/shape
253 1.1 christos combinations likely to be found in any reasonably complete type
254 1.1 christos family.
255 1.1 christos <p>
256 1.1 christos The actual extension names are arbitrary and can be used in a
257 1.1 christos flexible manner. For example, if you create a family that has a
258 1.1 christos DemiBold font (DB) but no Bold font (B), you might find it more
259 1.1 christos convenient to give the DemiBold font the extension "B".
260 1.1 christos Equally, if the family has an ExtraBold font, you might find it more
261 1.1 christos convenient to use the extension "HV" (Heavy).
262 1.1 christos <a name="REGISTER_STYLE"></a>
263 1.1 christos <p>
264 1.1 christos However, you may, at needs, want to add to <strong>mom</strong>'s
265 1.1 christos list of font styles. You can do this by editing the file, om.tmac.
266 1.1 christos Near the top, you'll see lines of the form
267 1.1 christos <p>
268 1.1 christos <pre>
269 1.1 christos .sty \n[.fp] L \" Light Roman
270 1.1 christos .sty \n[.fp] LI \" Light Italic
271 1.1 christos .sty \n[.fp] LCD \" Light Condensed Roman
272 1.1 christos </pre>
273 1.1 christos
274 1.1 christos Simply add your new font style by imitating what you see and
275 1.1 christos plugging in your new font style (having, of course, first created the
276 1.1 christos font, correctly named, in groff's PostScript font directory; see
277 1.1 christos <a href="#HOWTO">How to create a PostScript font for use with groff</a>).
278 1.1 christos <p>
279 1.1 christos For example, if you already have some fonts from the Univers
280 1.1 christos family installed and have called the family UN, you might decide at
281 1.1 christos some point to add the Bold Outline font (UNBO). In which case,
282 1.1 christos you'd add
283 1.1 christos <p>
284 1.1 christos <pre>
285 1.1 christos .sty \n[.fp] BO \" Bold Outline
286 1.1 christos </pre>
287 1.1 christos
288 1.1 christos to the <kbd>.sty \n[.fp] <font style></kbd> list in om.tmac.
289 1.1 christos <p>
290 1.1 christos Be careful, though, that any styles you add do not conflict
291 1.1 christos with <strong><u>family</u></strong> names that already exist.
292 1.1 christos "C", for example, conflicts with the Courier family
293 1.1 christos (CR, CI, CB, CI). Were you to create a font style "C",
294 1.1 christos thinking that <kbd>.FT C</kbd> would give you access to font style
295 1.1 christos once you'd given a <kbd>.FAM(ILY)</kbd> directive, you'd get a nasty
296 1.1 christos surprise: your type would come out in Courier Roman!
297 1.1 christos <p>
298 1.1 christos <strong>VERY IMPORTANT NOTE: mom</strong>'s font extensions are
299 1.1 christos not "user-space" controllable via a macro. If you've
300 1.1 christos been using groff for a long time, and have already rolled your own
301 1.1 christos solution to adding PostScript families, fonts, weights, shapes, etc. to
302 1.1 christos groff, you may find that <strong>mom</strong>'s font extensions
303 1.1 christos conflict with your own scheme. Should that be the case, comment out
304 1.1 christos the <kbd>.sty \n[.fp] <font style></kbd> lines found near the
305 1.1 christos top of the om.tmac file.
306 1.1 christos
307 1.1 christos <a name="HOWTO"><h3><u>How to create a PostScript font for use with groff</u></h3></a>
308 1.1 christos These instructions aren't meant to cover all possibilities, merely
309 1.1 christos to present one way of making PostScript families/fonts available to
310 1.1 christos groff and <strong>mom</strong>.
311 1.1 christos <p>
312 1.1 christos GNU/Linux distributions being what they are, directory locations may
313 1.1 christos differ and the presence of some executables can't be guaranteed.
314 1.1 christos I run a Debian system. The instructions reflect that. Users of
315 1.1 christos other distros will have to interpret them according to the way their
316 1.1 christos distro operates.
317 1.1 christos <p>
318 1.1 christos What you need before you start:
319 1.1 christos <br>
320 1.1 christos <ul>
321 1.1 christos <li>groff, version 1.18 or higher
322 1.1 christos <br>
323 1.1 christos (Debian package: groff)
324 1.1 christos <li>a full installation of gs and associated tools
325 1.1 christos <br>
326 1.1 christos (Debian package: gs or gs-gpl)
327 1.1 christos <li>a library of gs fonts
328 1.1 christos <br>
329 1.1 christos (Debian package: gsfonts)
330 1.1 christos <li>a utility for converting TrueType fonts to Type1 fonts
331 1.1 christos <br>
332 1.1 christos (Debian package: ttf2pt1)
333 1.1 christos <li>a font manager
334 1.1 christos <br>
335 1.1 christos (Debian packages: defoma, psfontmgr, dfontmgr)
336 1.1 christos <li>perl
337 1.1 christos <br>
338 1.1 christos (Debian package: perl)
339 1.1 christos </ul>
340 1.1 christos <br>
341 1.1 christos A reasonably complete installation of any major GNU/Linux distro
342 1.1 christos should already have these on your system, except perhaps for the
343 1.1 christos utility to convert TrueType fonts to Type1 fonts.
344 1.1 christos <p>
345 1.1 christos Initial preparation (you only have to do this once):
346 1.1 christos <br>
347 1.1 christos <ol>
348 1.1 christos <li>If you don't already have one, create a directory in your
349 1.1 christos home directory to hold new fonts. Any directory name will do.
350 1.1 christos I use ~/Fonts, with subdirectories for Type1, TrueType and Groff
351 1.1 christos fonts.
352 1.1 christos <a name="SITE-FONT"></a>
353 1.1 christos <li>Locate the groff directory, site-font. The exact location is
354 1.1 christos difficult to predict, owing to differences between distros
355 1.1 christos and whether you're using a pre-packaged groff or have built
356 1.1 christos it from source. Some typical locations are
357 1.1 christos <br>
358 1.1 christos <ul>
359 1.1 christos <li>/usr/share/groff,
360 1.1 christos <li>/usr/local/share/groff
361 1.1 christos <li>/etc/groff
362 1.1 christos </ul>
363 1.1 christos <p>
364 1.1 christos If you can't find the site-font directory, locate
365 1.1 christos groff's site-tmac directory, and, as root, create site-font
366 1.1 christos in the same directory as the one that holds site-tmac.
367 1.1 christos E.g., if you find site-tmac in /usr/share/groff, create
368 1.1 christos site-font in /usr/share/groff.
369 1.1 christos <li>Locate the file <kbd><prefix>/font/devps/generate/textmap</kbd>
370 1.1 christos and symlink it to <kbd>textmap</kbd> in the directory that
371 1.1 christos contains your personal collection of PostScript fonts. (See the
372 1.1 christos <a href="#SMALL_NOTE">Small Note</a>,
373 1.1 christos above, for the meaning of <prefix>). On my system,
374 1.1 christos at the time of writing, <prefix> is
375 1.1 christos /usr/local/share/groff/1.19.2/, therefore, I symlink it in
376 1.1 christos ~/Fonts/Type1 with
377 1.1 christos <br>
378 1.1 christos <pre>
379 1.1 christos ln -s /usr/local/share/groff/1.19.2/font/devps/generate/textmap textmap
380 1.1 christos </pre>
381 1.1 christos <li>Locate the file <prefix>/font/devps/text.enc and
382 1.1 christos symlink it to <kbd>text.enc</kbd> in your personal font
383 1.1 christos directory. On my system, in ~/Fonts/Type1
384 1.1 christos <pre>
385 1.1 christos ln -s /usr/local/share/groff/1.19.2/font/devps/text.enc text.enc
386 1.1 christos </pre>
387 1.1 christos <li>Make sure you know which directory/ies holds your gs fonts.
388 1.1 christos You'll need the information later. On a Debian box, some
389 1.1 christos typical locations are
390 1.1 christos <br>
391 1.1 christos <ul>
392 1.1 christos <li>/usr/lib/ghostscript/fonts
393 1.1 christos <li>/usr/share/ghostscript/fonts
394 1.1 christos <li>/usr/share/fonts/type1/gsfonts
395 1.1 christos </ul>
396 1.1 christos </ol>
397 1.1 christos <br>
398 1.1 christos Font creation/installation:
399 1.1 christos <br>
400 1.1 christos <ol>
401 1.1 christos <li>Acquire the font in either Type1 (.pfb) or TrueType
402 1.1 christos (.ttf) format.
403 1.1 christos <li>Place the font in your personal font directory; for me,
404 1.1 christos that's ~/Fonts/Type1 or ~/Fonts/TrueType.
405 1.1 christos <li>In your personal font directory, run one of the following:
406 1.1 christos <br>
407 1.1 christos <ul>
408 1.1 christos <li>For Type1 fonts
409 1.1 christos <br>
410 1.1 christos <ul>
411 1.1 christos <li><kbd>getafm fontfilename.pfb | gsnd - > fontfilename.afm</kbd>
412 1.1 christos <br>
413 1.1 christos For Type1 fonts, this will generate something called
414 1.1 christos an .afm (Adobe Font Metrics) file, which is
415 1.1 christos required to create PostScript fonts for groff.
416 1.1 christos </ul>
417 1.1 christos <li>For TrueType fonts
418 1.1 christos <br>
419 1.1 christos <ul>
420 1.1 christos <li><kbd>ttf2pt1 \-b fontfilename.ttf</kbd>
421 1.1 christos <br>
422 1.1 christos For TrueType fonts, this will generate a PostScript
423 1.1 christos .pfb file as well as an .afm file.
424 1.1 christos </ul>
425 1.1 christos </ul>
426 1.1 christos <li>Still in your personal font directory, run
427 1.1 christos <br>
428 1.1 christos <ul>
429 1.1 christos <li><kbd>afmtodit -e text.enc fontfilename.afm textmap GROFF_FONTNAME</kbd>
430 1.1 christos </ul>
431 1.1 christos <p>
432 1.1 christos Q: <em>How do I choose a GROFF_FONTNAME?</em>
433 1.1 christos <p>
434 1.1 christos A: Start by considering the
435 1.1 christos <a href="definitions.html#TERMS_FAMILY">family</a>
436 1.1 christos to which the font belongs. If you're adding to a family that
437 1.1 christos already exists in groff's <prefix>/font/devps
438 1.1 christos directory, that will be the first part of the font name.
439 1.1 christos (See
440 1.1 christos <a href="typesetting.html#FAMILY">here</a>
441 1.1 christos for a list of families already installed, along with their groff
442 1.1 christos names.) Add to that name the appropriate weight/style extension,
443 1.1 christos listed
444 1.1 christos <a href="#STYLE_EXTENSIONS">here</a>.
445 1.1 christos <p>
446 1.1 christos For example, if you're adding Helvetica Light Roman, your
447 1.1 christos GROFF_FONTNAME would be <strong>HL</strong>. If you're
448 1.1 christos adding Helvetica Light Italic, your GROFF_FONTNAME would be
449 1.1 christos <strong>HLI</strong>.
450 1.1 christos <p>
451 1.1 christos If you're adding a font not already in groff's PostScript
452 1.1 christos families, first choose a meaningful name for the
453 1.1 christos <a name="definitions.html#TERMS_FAMILY">family</a>
454 1.1 christos to which the font belongs. The name can be anything you like. If,
455 1.1 christos for example, the family is Garamond, you could choose GARAMOND,
456 1.1 christos GARA, GD, or even just plain G as the family name. Then tack on the
457 1.1 christos appropriate style/weight extension. Thus, if you were installing
458 1.1 christos Garamond Bold Condensed Italic and had chosen <strong>GD</strong>
459 1.1 christos as the family name for Garamond, your GROFF_FONTNAME would be
460 1.1 christos <strong>GDBCDI</strong>.
461 1.1 christos <p>
462 1.1 christos In <strong>mom</strong>, you can then access the Garamond
463 1.1 christos family with <kbd>.FAM GD</kbd>, and the Bold Condensed
464 1.1 christos Italic font wth <kbd>.FT BCDI</kbd>.
465 1.1 christos <p>
466 1.1 christos <strong>Note:</strong> The family name need not be in upper
467 1.1 christos case, and there's no limit to the length of the name.
468 1.1 christos "Garamond", for example, could be the name you
469 1.1 christos give the Garamond family. In fact, you might find it
470 1.1 christos preferable, since a) you wouldn't have to remember how
471 1.1 christos you'd named the family, and b) should you be scanning
472 1.1 christos your
473 1.1 christos <a href="#SITE-FONT">site-font directory</a>,
474 1.1 christos something like GaramondBCDI will be more meaningful than,
475 1.1 christos say, GDBCDI.
476 1.1 christos <li>Copy or move GROFF_FONTNAME to your
477 1.1 christos <a href="#SITE-FONT">site-font directory</a>,
478 1.1 christos or change to the site-font directory and make a symlink to
479 1.1 christos GROFF_FONTNAME in your personal directory.
480 1.1 christos <li>Copy or move the .pfb file to the directory that
481 1.1 christos holds your gs fonts, or change to that directory and make a
482 1.1 christos symlink to the .pfb file in your personal directory.
483 1.1 christos <li>Do whatever your system or distro requires in order to
484 1.1 christos register the new PostScript font (the .pfb file). On a
485 1.1 christos Debian system, as root, you can run dfontmgr for a
486 1.1 christos graphical interface that will take care of registering the
487 1.1 christos font.
488 1.1 christos </ol>
489 1.1 christos <p>
490 1.1 christos Written out in full, adding fonts looks like a lot of work. It
491 1.1 christos isn't. Basically, it's just:
492 1.1 christos <br>
493 1.1 christos <ul>
494 1.1 christos <li>acquire the font
495 1.1 christos <li>generate an .afm file for the font
496 1.1 christos <li>create the groff font
497 1.1 christos <li>put the groff font in <prefix>/font/devps
498 1.1 christos <li>make sure gs knows about the font
499 1.1 christos </ul>
500 1.1 christos <br>
501 1.1 christos After you've done it a couple of times, it all makes sense, and is
502 1.1 christos really quite easy. Not to mention that once you understand the
503 1.1 christos process, you can write a bash script to automate the process.
504 1.1 christos Here's an example, which you can adapt to your own needs. The
505 1.1 christos script requires an argument (the .pfb filename), then prompts for
506 1.1 christos the GROFF_FONTNAME.
507 1.1 christos <p>
508 1.1 christos <pre>
509 1.1 christos #! /bin/bash
510 1.1 christos
511 1.1 christos # A script for installing Type1 fonts.
512 1.1 christos #
513 1.1 christos # Builds .afm files from .pfb files, generates a groff font from the
514 1.1 christos # .afm file, makes a symlink in /usr/lib/ghostscript/font/ to the
515 1.1 christos # .pfb file, and a symlink in site-font to the groff font
516 1.1 christos
517 1.1 christos # .pfb filename, stripped of .pfb extension
518 1.1 christos FONT=`basename $1 .pfb`
519 1.1 christos
520 1.1 christos # Directory holding my personal collection of type1 fonts
521 1.1 christos FONTDIR="$HOME/Fonts/Type1"
522 1.1 christos
523 1.1 christos # Directory holding system ghostscript fonts
524 1.1 christos GS_FONTDIR="/usr/lib/ghostscript/fonts"
525 1.1 christos
526 1.1 christos # Location of site-font/devps
527 1.1 christos GROFF_SITE_FONTDIR="/usr/local/share/groff/site-font/devps"
528 1.1 christos
529 1.1 christos # Personal groff fonts directory
530 1.1 christos GROFF_FONTS="$HOME/Fonts/Groff"
531 1.1 christos
532 1.1 christos # Symlinks to textmap and text.enc
533 1.1 christos TEXTMAP="$FONTDIR/textmap"
534 1.1 christos TEXTENC="$FONTDIR/text.enc"
535 1.1 christos
536 1.1 christos if [ ! `pwd` = "$FONTDIR" ] ; then
537 1.1 christos echo "Changing into $FONTDIR directory.."
538 1.1 christos cd $FONTDIR
539 1.1 christos sleep 1
540 1.1 christos else
541 1.1 christos sleep 1
542 1.1 christos fi
543 1.1 christos
544 1.1 christos echo -n "Groff name for this font: "
545 1.1 christos read FONTNAME
546 1.1 christos sleep 1
547 1.1 christos
548 1.1 christos echo "Getting .afm.."
549 1.1 christos getafm $FONT.pfb | gsnd - > $FONT.afm
550 1.1 christos sleep 1
551 1.1 christos
552 1.1 christos echo "Creating $FONTNAME.."
553 1.1 christos afmtodit -e $TEXTENC $FONTDIR/$FONT.afm $TEXTMAP $FONTNAME
554 1.1 christos mv -i $FONTNAME $GROFF_FONTS
555 1.1 christos sudo ln -s $GROFF_FONTS/$FONTNAME $GROFF_SITE_FONTDIR/$FONTNAME
556 1.1 christos sleep 1
557 1.1 christos
558 1.1 christos echo "Linking $FONT in $GS_FONTDIR.."
559 1.1 christos cd $GS_FONTDIR
560 1.1 christos sudo ln -s $FONTDIR/$FONT.afm $FONT.afm
561 1.1 christos sudo ln -s $FONTDIR/$FONT.pfb $FONT.pfb
562 1.1 christos sleep 1
563 1.1 christos
564 1.1 christos # This next bit is Debian specific. If you're not running a
565 1.1 christos # Debian system, replace it with whatever your distro requires
566 1.1 christos # in order to register Type1 fonts.
567 1.1 christos
568 1.1 christos if [ !`pidof -x /usr/bin/dfontmgr` ] ; then
569 1.1 christos echo "I will now run dfontmgr so you can register the font."
570 1.1 christos exec sudo dfontmgr &
571 1.1 christos else
572 1.1 christos echo "You may now register the font with dfontmgr."
573 1.1 christos fi
574 1.1 christos </pre>
575 1.1 christos <hr>
576 1.1 christos
577 1.1 christos <!=====================================================================>
578 1.1 christos
579 1.1 christos <a name="CODENOTES">
580 1.1 christos <h2><u>Some reflections on mom</u></h2>
581 1.1 christos </a>
582 1.1 christos
583 1.1 christos <p>
584 1.1 christos <strong>Mom</strong>, as a complete macro set, had her origins
585 1.1 christos in a "library" of groff routines I wrote over the
586 1.1 christos years to handle various aspects of typesetting and document
587 1.1 christos processing that weren't adequately covered by ms, me, mm, and so
588 1.1 christos on. Typically, I'd use the library to cobble together macro
589 1.1 christos sets for new challenges as they came my way.
590 1.1 christos <p>
591 1.1 christos If, as Eric Raymond asserts, open source begins with a programmer
592 1.1 christos scratching a personal itch, then <strong>mom</strong> can truly be
593 1.1 christos called open source, even if, a mere humble set of macros standing on
594 1.1 christos the shoulders of a giant named troff, she isn't programming at all.
595 1.1 christos <p>
596 1.1 christos As a writer living in a perpetual state of penury, all the computers
597 1.1 christos I've ever owned have been hand-me-downs -- several generations
598 1.1 christos out-of-date and "resource challenged". Disk space has
599 1.1 christos always been an issue, as has processor speed and available RAM.
600 1.1 christos One of the reasons I run GNU/Linux is that it has helped enormously
601 1.1 christos to get the most out of my poor little boxes. (It has been pointed
602 1.1 christos out to me that NetBSD might be an even better choice of operating
603 1.1 christos systems for computers with limited resources.)
604 1.1 christos <p>
605 1.1 christos In Linux-land, the choice of typesetting systems basically comes down
606 1.1 christos to groff or TeX. Both are wonderful -- monumental achievements if you
607 1.1 christos ask me -- and both have their own particular strengths. However, for
608 1.1 christos people in my financial position (and there are millions of us around
609 1.1 christos the globe, in both developed and developing countries), TeX and groff
610 1.1 christos have one big difference: size. TeX is huge. Even its most ardent
611 1.1 christos supporters agree it suffers from bloat, on top of being complex and
612 1.1 christos unwieldy to manage. Groff is tiny by comparison, occupying minimal
613 1.1 christos disk space and having only a small memory footprint while at the same
614 1.1 christos time being flexible and powerful, typographically speaking. I've run
615 1.1 christos it successfully on a 386 with 8 megs of RAM and a 250 meg hard disk.
616 1.1 christos <p>
617 1.1 christos However, groff has always had a liability: it's incredibly geeky.
618 1.1 christos Owing to its very long history, it -- and its "power users"
619 1.1 christos -- have remained stuck in a time warp. Most common macro packages
620 1.1 christos still look as they did in those decades when memory was exorbitantly
621 1.1 christos expensive and every byte mattered. Documentation -- not always
622 1.1 christos easy to find -- is written as if all readers are computer whizzes,
623 1.1 christos or at least have a university degree in one of the higher sciences.
624 1.1 christos <p>
625 1.1 christos By no means a stupid man, nor unfamiliar with the precepts of
626 1.1 christos programming, I've more than once torn my hair out over the terseness and
627 1.1 christos ambiguity of groff's documentation. Making sense of certain primitives
628 1.1 christos has often involved days of testing, interpreting the documentation
629 1.1 christos instead of just using the primitive.
630 1.1 christos <p>
631 1.1 christos (ADDENDUM to the previous two paragraphs: A tremendous amount of
632 1.1 christos effort has gone into creating a groff manual that can be read with
633 1.1 christos "info," as well as creating truly useful man pages. The info
634 1.1 christos manual is clear and well-written, so my comments are actually out
635 1.1 christos of date. I leave them in for the benefit of groff newbies, who may
636 1.1 christos still find the documents a bit intimidating.)
637 1.1 christos <p>
638 1.1 christos For some time now, groff users and macro writers have had the
639 1.1 christos option to use "long" names, yet have mostly chosen not to.
640 1.1 christos With long names, it's possible to create macro sets that are humanly
641 1.1 christos readable and easy to interpret, encouraging development and evolution.
642 1.1 christos What's more, the macros themselves need not be terse, intimidating,
643 1.1 christos and easily forgotten 1- or 2-letter commands inserted in the body
644 1.1 christos of a document. They can be sensible and helpful to everyone, groff
645 1.1 christos newbies and old hands alike.
646 1.1 christos <p>
647 1.1 christos <strong>Mom</strong>'s macro file, om.tmac, uses long names, aliases,
648 1.1 christos and a host of other groff goodies that have become part of the
649 1.1 christos whole groff picture under the unflagging guidance of groff's current
650 1.1 christos maintainer, Werner Lemberg. Nearly every macro, number register and
651 1.1 christos string is "recognizable" simply by its name. The file is
652 1.1 christos heavily commented. A consistent, if idiosyncratic, indenting style
653 1.1 christos is used as well, significantly improving readability. Anyone
654 1.1 christos wanting to futz around with <strong>mom</strong>'s macros should be
655 1.1 christos able to do so with a minimum of head scratching.
656 1.1 christos <br>
657 1.1 christos <hr>
658 1.1 christos
659 1.1 christos <!=====================================================================>
660 1.1 christos
661 1.1 christos <a name="CONTACT">
662 1.1 christos <h2><u>Contact the author</u></h2>
663 1.1 christos </a>
664 1.1 christos
665 1.1 christos <p>
666 1.1 christos If you have any questions or comments about <strong>mom</strong>,
667 1.1 christos suggestions to make, criticisms to offer, or bugs to report, use the
668 1.1 christos groff mailing list at
669 1.1 christos <a href="mailto:groff (a] ffii.org">groff (a] ffii.org</a>
670 1.1 christos (subscription information available
671 1.1 christos <a href="http://ffii.org/mailman/listinfo/groff/">here</a>)
672 1.1 christos or contact me, Peter Schaffter, directly at
673 1.1 christos <i>peter@faustus.dyn.ca</i>
674 1.1 christos or
675 1.1 christos <i>ptpi@golden.net</i>.
676 1.1 christos
677 1.1 christos <p>
678 1.1 christos Please include the word "mom" or "groff" in the
679 1.1 christos Subject: line of any message sent to my personal address, or you
680 1.1 christos risk the wrath of my implacable spam filters. :)
681 1.1 christos <p>
682 1.1 christos If you want to visit <strong>mom</strong>'s homepage, you'll find
683 1.1 christos it
684 1.1 christos <a href="http://faustus.dyn.ca/mom/mom.html">here</a>.
685 1.1 christos <p>
686 1.1 christos <hr>
687 1.1 christos <a href="reserved.html#TOP">Next</a>
688 1.1 christos <a href="macrolist.html#TOP">Prev</a>
689 1.1 christos <a href="#TOP">Top</a>
690 1.1 christos <a href="toc.html">Back to Table of Contents</a>
691 1.1 christos </body>
692 1.1 christos </html>
693