Software: Apache. PHP/8.1.30 uname -a: Linux server1.tuhinhossain.com 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC uid=1002(picotech) gid=1003(picotech) groups=1003(picotech),0(root) Safe-mode: OFF (not secure) /usr/share/doc/groff-base/html/mom/ drwxr-xr-x |
Viewing file: Select action/file-type:
AppendicesAdding fonts to groff
<prefix>, in this section, refers
to the directory in which groff is installed, typically
<version> refers to the groff version number, which
can be found, if necessary, by typing
Groff comes with a small library of
families
(see the
FAMILY
macro for a list). The families have four
fonts
associated with them. These fonts are a combination of
weight
and
shape:
Extending groff families / adding new families and fontsThe traditional approachThe 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, or Condensed, which is a shape), then to associate them with groff’s predefined R, I, B and BI font styles. An example of this can be seen in the groff PostScript font library itself, which is found in <prefix>/<version>/font/devps/ There’s one “family” for Helvetica (HR, HI, HB, HBI) and another for Helvetica Narrow (HNR, HNI, HNB, HNBI). The difficulty with this approach is that typographers tend to think of families as referring to the entire set of font weights and shapes associated with a family name. For example, when a typesetter says “the Helvetica family”, s/he is including the weights Helvetica Thin, Helvetica Light, Helvetica Regular, Helvetica Bold, Helvetica Heavy, etc, and all their associated shapes (Roman, Italic, Condensed, Narrow, Extended, Outline, etc). Thus, intuitively, when a typesetter gives mom a .FAMILY H directive, s/he reasonably expects that any subsequent .FT directive will access the desired font from the Helvetica family—without the need to state explicitly both family and font to .FT, as it is explained one can do in the FAMILY and FT sections of these documents. If one had, say, Helvetica Light Roman and Helvetica Light Italic as well as Helvetica Light Condensed Roman and Helvetica Light Condensed Italic, the established groff approach would require two “partial” families, HL (for Helvetica Light) and HLCD (for Helvetica Light Condensed), with R and I fonts for both: HLR HLI HLCDR HLCDI Accessing these family/font combos routinely throughout a document would then require changing the family (with .FAMILY) and selecting the desired font (with .FT R or .FT I), or passing .FT the lengthy family+fontname (.e.g. .FT HLCDI). The simpler way with momFortunately, groff provides a mechanism whereby it’s possible to extend the basic R, I, B and BI fonts (“styles” in groff-speak) so that one can, in fact, create extensive type families, and access all the fonts in them with .ft (groff) or .FT (mom). Mom uses this mechanism to offer, in addition to groff’s default font styles, the following:
UL = Ultra Light
ULI = Ultra Light Italic
ULCD = Ultra Light Condensed
ULCDI = Ultra Light Condensed Italic
ULEX = Ultra Light Extended
ULEXI = Ultra Light Extended Italic
XL = Extra Light
XLI = Extra Light Italic
XLCD = Extra Light Condensed
XLCDI = Extra Light Condensed Italic
XLEX = Extra Light Extended
XLEXI = Extra Light Extended Italic
TH = Thin
THI = Thin Italic
THCD = Thin Condensed
THCDI = Thin Condensed Italic
THEX = Thin Extended
THEXI = Thin Extended Italic
L = Light Roman
LI = Light Italic
LCD = Light Condensed
LCDI = Light Condensed Italic
LEX = Light Extended
LEXI = Light Extended Italic
BK = Book Roman
BKI = Book Italic
BKCD = Book Condensed
BKCDI = Book Condensed Italic
BKEX = Book Extended
BKEXI = Book Extended Italic
CD = Medium Condensed
CDI = Medium Condensed Italic
EX = Medium Extended
EXI = Medium Extended Italic
DB = DemiBold Roman
DBI = DemiBold Italic
DBCD = DemiBold Condensed
DBCDI = DemiBold Condensed Italic
DBEX = DemiBold Extended
DBEXI = DemiBold Extended Italic
SB = SemiBold Roman
SBI = SemiBold Italic
SBCD = SemiBold Condensed
SBCDI = SemiBold Condensed Italic
SBEX = SemiBold Extended
SBEXI = SemiBold Extended Italic
BCD = Bold Condensed
BCDI = Bold Condensed Italic
BEX = Bold Extended
BEXI = Bold Extended Italic
BO = Bold Outline
XB = Extra Bold
XBI = Extra Bold Italic
XBCD = Extra Bold Condensed
XBCDI = Extra Bold Condensed Italic
XBEX = Extra Bold Extended
XBEXI = Extra Bold Extended Italic
UB = Ultra Bold
UBI = Ultra Bold Italic
UBCD = Ultra Bold Condensed
UBCDI = Ultra Bold Condensed Italic
UBEX = Ultra Bold Extended
UBEXI = Ultra Bold Extended Italic
HV = Heavy
HVI = Heavy Italic
HVCD = Heavy Condensed
HVCDI = Heavy Condensed Italic
HVEX = Heavy Extended
HVEXI = Heavy Extended Italic
BL = Black
BLI = Black Italic
BLCD = Black Condensed
BLCDI = Black Condensed Italic
BLEX = Black Extended
BLEXI = Black Extended Italic
BLO = Black Outline
XBL = Extra Black
XBLI = Extra Black Italic
XBLCD = Extra Black
XBLCDI = Extra Black
XBLEX = Extra Black Italic
XBLEXI = Extra Black Italic
UBL = Ultra Black
UBLI = Ultra Black Italic
UBLCD = Ultra Black Condensed
UBLCDI = Ultra Black Condensed Italic
UBLEX = Ultra Black Exteneded
UBLEXI = Ultra Black Extended Italic
SC = Small Caps Roman
SCI = Small Caps Italic
SCDB = Small Caps Demibold
SCDBI = Small Caps Demibold Italic
SCSB = Small Caps Semibold
SCSBI = Small Caps Semibold Italic
Thus, with mom, if you’ve installed some extra
Helvetica fonts and named them according to the convention
<F><S> (where <F> means
family and <S> means font style), once having
entered
Mom’s list of font styles doesn’t pretend to be exhaustive. The 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 “B”.
You may, at needs, want to add to mom’s list of font styles.
You can do this by editing the file, om.tmac (typical location:
<prefix>/<version>/tmac/om.tmac). Near the
top, you’ll see lines of the form
For example, if you already have some fonts from the Univers family
installed and have called the family Univers, you might decide at
some point to add the Bold Outline font (UniversBO). In which
case, you’d add
Note: Mom’s font extensions are not “user-space” controllable via a macro. If you’ve been using groff for a long time, and have already rolled your own solution to adding families and fonts to groff, you may find that mom’s font extensions conflict with your own scheme. Should that be the case, comment out the .sty \n[.fp] <font style> lines found near the top of the om.tmac file. Important: Be careful that any styles you add do not conflict with family names that already exist. “C”, for example, conflicts with the Courier family (CR, CI, CB, CI). Were you to create a font style “C”, thinking that .FT C would give you access to font style once you’d given a .FAMILY directive, you’d get a nasty surprise: your type would come out in Courier Roman! Step-by-step instructionsThere are a number of ways to approach making fonts available to groff. These instructions aren’t meant to cover all possibilities, merely one. 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-based system. The instructions reflect that. Users of other distros may have to interpret them according to the way their distro operates. What you need before you start
Initial preparation (you only need do this once)
Step 1: Acquire the fontThe two most commonly available types of fonts are PostScript Type1 (extension .pfb) and TrueType (extension .ttf). Either can be made available to groff. There are many websites holding collections of both. Step 2: Prepare to convert the font to the correct formatChange into the directory holding the new font.
For convenience in the next step, make a symbolic link to
the file 'textmap':
In addition, unless you're installing fonts from your home
directory, make links to the files 'generate-t42.pe' and
'generate-pfa.pe'.
Step 3: Convert the font and put it in the right placeTrueType fonts (.ttf) need to be converted to .t42. Type 1 fonts (.pfb) need to be converted to .pfa. • TTF Fonts
For .ttf fonts, run
Move the .t42 and groff font files to <prefix>/site-font/devps/. If you're running a recent version of groff that includes the native pdf device (gropdf), move the .pfa file to <prefix>/<version>/font/devpdf/. If not, you may safely remove it. You may also safely remove the .afm file. • Type1 Fonts
For .pfb fonts, run
If you're running a recent version of groff that includes the
native pdf device (gropdf), link the .pfa and groff font files,
now in <prefix>/<site-font>/devps/,
to the devpdf directory. Start by changing into the
<prefix>/<version>/font/devpdf/ directory,
then:
Step 4: Update the download file• Get the internal font name
Inspect your new groff font file. Near the top, you will see a line
of the form
• Add the font to the download file
Open the file <prefix>/<version>/font/devps/download.
In it you will see lines of the form
The download file maps the internal names used by groff to the actual fonts. To add your new font to the download file, append a line containing the internal name, followed by a tab (make sure your text editor is inserting the tab character, not spaces), followed by the .t42 or .pfa font to which the internal name refers.
For example, if the internal name is Optima-Bold and the font is a
.pfa file called Optima-Bold.pfa, your updated download file will
contain
• Updating the gropdf download file
If you're running a recent version of groff that includes the
native pdf device (gropdf), you must update its download file as
well, which is found in <prefix>/<version>/font/devpdf/.
The instructions are identical to those above, but with one important
difference: all lines must begin with a tab character. Thus, using
our Optima example, your devpdf download line for the same font is
Naming groff fonts
For convenience when using mom, and to keep your font collection
organized, choose meaningful groff font names following the scheme
<Family><FONT>, where Family is something
like Optima or Univers or Clarendon, and FONT is either
Groff font names are, in fact, arbitrary; you can call your fonts anything you like, provided the internal name in the download file matches the internal name found in the groff font file. When calling a font that does not follow the recommended naming convention, you must pass the full font name to .FT whenever you wish to use it. For example, the font, Goudy Stout, isn't really part of the Goudy family, and while "stout" describes it, Stout is not a recognized font style. Therefore, its groff name could simply be GoudyStout, and whenever you needed it, you could call it with .FT GoudyStout. Automate the whole process – the install-font scriptA bash script to make the entire process of installing fonts a painless no-brainer has been posted online at http://www.schaffter.ca/mom/install-font. Be sure to make the script executable (chmod 755 install-font) after you download it, then type ./install-font -H for usage. Some reflections on momIf, as Eric Raymond asserts, open source begins with a programmer scratching a personal itch, then mom can truly be called open source. Mom had her origins in a library 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 friends. Typically, I’d use the library to cobble together macro sets for new challenges as they came my way. As a writer living in a perpetual state of penury, all the computers I’ve ever owned have been hand-me-downs—several generations out-of-date and resource challenged. Disk space has always been an issue, as has processor speed and available RAM. One of the reasons I run GNU/Linux rather than the offering from Redmond is that it has helped enormously to get the most out of my poor little boxes. In Linux-land (all Unix variants, in fact), the choice of typesetting systems basically comes down to groff or TeX. Both are wonderful—monumental achievements if you ask me—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. Back in the Jurassic Period, I ran it successfully on a 386 with 8 megs of RAM and a 250 meg hard disk. However, groff has always had a liability: it’s incredibly geeky. Owing to its very long history, it—and its power users —seem to have remained stuck in a time warp. The canonical macro packages still look as they did back in those decades when memory was exorbitantly expensive and every byte mattered. For some time now, groff users and macro writers have had the option to use “long” names for macros (i.e. longer than two letters, the original limit), 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. Mom’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. The function of nearly every macro, number register and string can be infered simply from 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 mom’s macros should be able to do so with a minimum of head scratching. Note: The main macro file, om.tmac, is 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 mom’s homepage. Contact the author
If you have any questions or comments about mom, suggestions to
make, criticisms to offer, or bugs to report, use the groff mailing
list (subscription information available
here)
or contact me, Peter Schaffter, directly at the following
address:
If you want to visit mom’s website, you’ll find a link
to it at
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.004 ]-- |