Red Hat Bugzilla – Bug 9312
MM macro support for font family
Last modified: 2008-05-01 11:37:54 EDT
I am gratified that groff and the MM macros are being actively
maintained. They remain an essential tool and it's wonderful to have
such a faithful reimplementation in Linux.
Years ago at Bell Labs, I wrote these golden words about the MM
"According to the PostScript Tutorial and Cookbook, 'A font is a
collection of characters with a unified design. The design itself
is referred to as a typeface. A set of typefaces designed to work
together in a pleasing way is called a typeface family.'
The MM macros, .R .I .B .RI .RB .IR .IB .BR and .BI, provide a
powerful and convenient way to pop around among the Roman, Italic
and Bold fonts. ... The MM macros do not explicitly mention the R,
I, and B fonts. Instead they use mounted fonts 1, 2 and 3.
Therefore simply by using the troff commands to mount the Roman,
Italic and Bold members of a family in font positions 1, 2 and 3
we can have full use of any font family."
For example, to use the New Century Schoolbook family instead of the
default Times Roman, insert these mount commands at the beginning of
.fp 1 NR
.fp 2 NI
.fp 3 NB
I should add this does not preclude switching to another font, but one
must be be careful not to accidentally return to \fR instead of \f1.
This capability seems to be missing from the groff package, but is
easily added. Simply replace each instance of an explicit font by it's
position number, ie
\fR -> \f1
\fI -> \f2
\fB -> \f3
.ft R -> .ft 1
.ft I -> .ft 2
.ft B -> .ft 3
I think only tmac.mm needs to be changed. I have run some empirical
tests but cannot be certain I've covered every case.
It's not clear to me whether similar changes should be made in the
mm/*.MT files. I think not. These seem to dictate the style of
various headers, and probably should not be altered.
Here is the diff for tmac.m:
# diff tmac.mSTD tmac.mDAD
< .ft R
> .ft 1
< .ie \\n[.$] .fnt@switch \fB \f[\\n[.f]] \\$@
< .el .ft B
> .ie \\n[.$] .fnt@switch \f3 \f[\\n[.f]] \\$@
> .el .ft 3
< .ie \\n[.$] .fnt@switch \fI \f[\\n[.f]] \\$@
< .el .ft I
> .ie \\n[.$] .fnt@switch \f2 \f[\\n[.f]] \\$@
> .el .ft 2
< .if \\n[.$] .fnt@switch \fI \fB \\$@
> .if \\n[.$] .fnt@switch \f2 \f3 \\$@
< .if \\n[.$] .fnt@switch \fB \fI \\$@
> .if \\n[.$] .fnt@switch \f3 \f2 \\$@
< .if \\n[.$] .fnt@switch \fI \fR \\$@
> .if \\n[.$] .fnt@switch \f2 \f1 \\$@
< .if \\n[.$] .fnt@switch \fR \fI \\$@
> .if \\n[.$] .fnt@switch \f1 \f2 \\$@
< .if \\n[.$] .fnt@switch \fR \fB \\$@
> .if \\n[.$] .fnt@switch \f1 \f3 \\$@
< .if \\n[.$] .fnt@switch \fB \fR \\$@
> .if \\n[.$] .fnt@switch \f3 \f1 \\$@
< \s+4\fB\\*[App]\ \\$1\fP\s0
> \s+4\f3\\*[App]\ \\$1\fP\s0
May I then also suggest this slight alteration for groff_mm(7):
B [bold-text] [prev-text] ...
With no arguments, switch to bold; with arguments, alternate - print
first argument in bold, second in previous font, third in bold, etc.
Any number of arguments are permitted; all will be concatenated without
added whitespace. Whitespace may be included if it is quoted.
The B, I and R macros specify Bold, Italic and Roman, respectively,
for the odd arguments.
The BI, BR, IB, IR, RB and RI macros explicitly specify the font for
both the odd and even arguments.
R I and B refer to the fonts mounted as 1, 2 and 3, which are
Times-Roman, Times-Italic and Times-Bold by default. To use a
different typeface family such as New Century Schoolbook, mount all
three components, eg
.fp 1 NR
.fp 2 NI
.fp 3 NB
This looks like a good idea, but your "cannot be certain I've covered every
case" gives me pause. Um, exactly how certain are you, and what types of
breakage might we expect? (sez' a blissfully clueless groff maintainer :-)
assign to laroche
I'd be much more comfortable if this would be discussed with the upstream
maintainer of groff. Otherwise I fear that we would have to implement this
change for a longer time within Red Hat Linux sources.
Florian La Roche