diff options
author | G. Branden Robinson <g.branden.robinson@gmail.com> | 2023-07-19 01:58:07 -0500 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2023-07-19 23:04:15 +0100 |
commit | bbf7701c4f8269090a12791f3c9bde80d45c8765 (patch) | |
tree | f0e36536114a1ff6daa2877feda9cabba8d7a649 /man | |
parent | f6fbdf898863675253d1eb5ed211de9914303be8 (diff) |
Improve lexgrog(1) portability
This fixes a test failure in man1/lexgrog.1 when building against groff
1.23.0.
Borrow code from groff 1.23.0's "an-ext.tmac" file (licensed as
permissively as a decadent society) to implement `EX` and `EE` extension
macros from Ninth Edition Research Unix (1986) (and groff) to get
monospaced code displays in a more portable way. There is no way to
portably change font families in pure man(7) itself, and the names of
troff typefaces aren't very portable either. There is also no portable
way to test for the _existence_ of a font. FTW.
("Portable" here largely means "to AT&T device-independent troff
implementations", for which there has been no official source since the
mid-1990s.[1] Several AT&T Unix System V licensees/descendants have
continued to ship their own vendored versions, but these have enjoyed
little or no development for the past 3 decades.)
* Define a string `mC` to store the name of a presumed monospaced roman
typeface. Use "CW", which is portable to AT&T device-independent
troff of the early 1980s before it occurred to anyone that Courier
might someday be available in italic and bold styles (and budget
available to purchase them).
* Define `mC` as "CR" if using a typesetting device and the formatter is
groff, or claims groff compatibility by the setting the `.g` register.
This is reasonably portable to modern implementations given
traditional troff font naming practices and the pervasive influence of
Adobe Software and the "base fonts" of its PostScript and PDF
specifications.
* If not typesetting (i.e., if using nroff), define `mC` as "R", which
is certain to be available.
* Define `EX` and `EE` macros as groff does, if the formatter does not
set the `.g` register.
* Migrate from `ft CW` and `nf` requests to `EX` macro calls.
* Migrate from `ft P` and `fi` requests to `EE` macro calls.
* Replace an inline use of `\f(CW` with a change to inline bold. There
is to date no portable way to inline a font family change.
Test passes now. Tested as-is and with the `EX` and `EE` macro
definitions forcibly enabled.
[1] https://groups.google.com/g/comp.text/c/COkqrii4W0E/m/7HarA8Ha2dAJ
Diffstat (limited to 'man')
-rw-r--r-- | man/man1/lexgrog.man1 | 57 |
1 files changed, 43 insertions, 14 deletions
diff --git a/man/man1/lexgrog.man1 b/man/man1/lexgrog.man1 index 37b9d287..f9f708f8 100644 --- a/man/man1/lexgrog.man1 +++ b/man/man1/lexgrog.man1 @@ -5,6 +5,41 @@ .\" You may distribute under the terms of the GNU General Public .\" License as specified in the file docs/COPYING.GPLv2 that comes with the .\" man-db distribution. +.\" +.ds mC CW +.if t .if \n(.g .ds mC CR +.if n .ds mC R +. +.nr mE 0 \" in an example (EX/EE)? +. +.if \n(.g \{\ +.de EX +. br +. if !\\n(mE \{\ +. nr mF \\n(.f +. nr mP \\n(PD +. nr PD 1v +. nf +. ft \\*(mC +. nr mE 1 +. \} +.. +.\} +. +. +.\" End example. +.if \n(.g \{\ +.de EE +. br +. if \\n(mE \{\ +. ft \\n(mF +. nr PD \\n(mP +. fi +. nr mE 0 +. \} +.. +.\} +. .pc .TH LEXGROG 1 "%date%" "%version%" "Manual pager utils" .SH NAME @@ -133,12 +168,10 @@ macro set, a correct section looks something like this: .PP .RS -.ft CW -.nf +.EX \&.SH NAME foo \e\- program to do something -.fi -.ft P +.EE .RE .PP Some manual pagers require the \(oq\e\-\(cq to be exactly as shown; @@ -157,18 +190,16 @@ If several features with different descriptions are being documented in the same manual page, the following form is therefore used: .PP .RS -.ft CW -.nf +.EX \&.SH NAME foo, bar \e\- programs to do something \&.br baz \e\- program to do nothing -.fi -.ft P +.EE .RE .PP -(A macro which starts a new paragraph, like \f(CW.PP\fP, may be used instead -of the break macro \f(CW.br\fP.) +(A macro which starts a new paragraph, like \fB.PP\fP, may be used instead +of the break macro \fB.br\fP.) .PP When using the BSD-derived .I mdoc @@ -177,13 +208,11 @@ macro set, a correct section looks something like this: .PP .RS -.ft CW -.nf +.EX \&.Sh NAME \&.Nm foo \&.Nd program to do something -.fi -.ft P +.EE .RE There are several common reasons why whatis parsing fails. |