Re: grohtml: confused about constant-width font handling
"G. Branden Robinson" <[email protected]>
| Newsgroups | gmane.comp.printing.groff.general |
|---|---|
| Message-ID | <20260123201029.ozpk7om2jqjefbno@illithid> |
At 2026-01-21T09:55:16+0000, Colin Watson wrote:
> On Tue, Jan 20, 2026 at 11:49:09AM -0600, G. Branden Robinson wrote:
> > At 2026-01-20T16:18:11+0000, Colin Watson wrote:
> > > - but doesn't any more. What's going on?
> >
> > The font name "C" is not portable and is now deprecated.
>
> I think you misunderstand my "What's going on?" complaint.
Apparently so. Sorry!
> If I could make out _how_ the combination of ".nf" and ".ft C" is
> having this effect on grohtml output, I might be able to get
> somewhere. But I have entirely failed to trace the actual code,
> especially given that post-grohtml is explicitly special-casing the
> "CR" font to have what looks like a similar effect - but in a way that
> I haven't been able to get to work.
My guess is that it has to do with the MTSM, the mini-troff state
machine that is part of grohtml's design but which required an incursion
into the formatter itself.
https://cgit.git.savannah.gnu.org/cgit/groff.git/tree/src/roff/troff/mtsm.h?h=1.23.0
https://cgit.git.savannah.gnu.org/cgit/groff.git/tree/src/roff/troff/mtsm.cpp?h=1.23.0
This machinery is known to be buggy:
https://savannah.gnu.org/bugs/?65894 (fixed)
https://savannah.gnu.org/bugs/?64453 (open)
...but worse than that, it lacks a specification, is undocumented beyond
the Mulley/Lemberg white paper[1] that is aimed at an audience other
than groff users or developers, and has no supporting automated tests.
My **ROUGH** idea of how it works is:
Macro packages, and the formatter itself, can inject "tags" into the
grout command stream. These are in the form of device extension
commands. So far, so good.[2] These tags, with names like EOL, BR, FI,
IN, LL, PO, RJ, SP, TA, and CE, serve to smuggle information about
*roff requests issued to the output device. Moreover, the formatter
doesn't _simply_ pass these through, but for reasons I'm not clear on,
maintains a stack of these tags. I don't know under what circumstances
the formatter pops the stack or clears/flushes it. I also don't know if
the grohtml output driver also maintains a tag stack, because I haven't
looked closely enough to see.
My wild guess as to what's happening is that either the formatter or the
output driver is inspecting the tag stack and inferring that if `nf`
(not FI, I guess) and `ft C` (I don't know how this is
captured/represented as a tag) are in propinquity then what is "really
meant" is a "<pre>" region, and grohtml generates HTML elements
accordingly.
That's a hypothesis, and a hard one to test due to my gripes above. So
take it with a shaker of salt.
> I'm explicitly not looking for an explanation of the typography at
> this time. I'm just trying to figure out the code flow.
Let me know if I can be of assistance. Beyond becoming an expert on
MTSM overnight, which isn't likely.
Regards,
Branden
[1] https://www.gnu.org/software/groff/grohtml.pdf
[2] Except the part about the formatter itself doing this, which I
philosophically object to, but is necessary if you want to produce
good HTML from "raw" *roff input. I think that's a mistaken
objective, because there's no demand for that. Macro packages can
inject any "tags" that are required.
signature.asc
(application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEh3PWHWjjDgcrENwa0Z6cfXEmbc4FAmlz1asACgkQ0Z6cfXEm bc6N+hAAgbRxLK6tt4hntuLu6WbNAdS5gNrLzVSEx/GlgNpsZNBvpstqq0mmHPnm h7++KYP4YugluFrLSV8ElfTH0Htriyxy+KyPYl8G4EVXalk8dhorAj/ZIGrgBXMe +/3+bNOzCyuiagHzdaJNPCOIr+r+3R9LVj+tKi0xQjOykgKC1j+XzL+AEN4Zh9La sf6MK94femOor8vjOWBcikfUkaBGN/57sA2trrKoKQjvAZEf+RWtJiFZ35ExMFFO pu7CSf/iGIN1BnAtJFdGLFZmvsC3IaSQnOYXsPAwx5QcIy/8AqZHme+e7pfkXeS/ ukwv8uw/+prYozoK2sNGs3+8mlXDe4d3jjF3g6C8GZCEypY4XNRuwwK3jR3rTft4 RKTrv6OOl/zDds+tbN78Bf7JhOoCF/WpWsvqYXEcQ0gs4d3UyA6PusbL1GelZFm3 TniN6ucjvhJ3qiuphNgvOOVH5CA+mqmtrQQAZfIberVJ865SIZ5MoSY4LzFPGECK exdZYGC5+L5SpU/t6VCh+meeGoZVrG3AF/XejbVoykvz5XT2NLhCVtSCtkghxcPu qK3dcOPHL6sRCnOp9FvnibAhTYKcnGf82N1EGyW9U0RAHnwPnS12QXwJPZA6KfFV EZejqk93cF2/5uBO+0xKiyiWsYgv2xIBnbFmyCqNFCOaHx+TWTo= =RaEQ -----END PGP SIGNATURE-----