Hi Colin, At 2026-01-20T15:20:55+0000, Colin Watson wrote: > I'm working through some Debian packages whose tests fail with groff > 1.24.0.rc1. One of those is xlbiff, where there was a previous > attempt to improve the handling of constant-width font selection in > https://github.com/edsantiago/xlbiff/commit/e0987fbbcd2304b389f70bbedb9ab9201c8bd7f1. > > My current plan is to add the following preamble to the affected > pages: > > .ie n .ds CR R > .el .ds CR CR
The name "CR" is a groffism, but you probably knew that. (There are no
portable font names in AT&T troff.) Just making full disclosure.
>
> ... and then just use `.ft \*(CR` in each of the places where it
> currently has a conditional. This seems to work fine for utf8, ps,
> and pdf output.
Yup. Go for it!
> However, when I tested with -Thtml I found that the expected <pre> or <tt>
> tag was missing. I don't exactly remember how this works, so I poked around
> in src/devices/grohtml/post-html.cpp and found this:
>
> void html_printer::start_font (const char *fontname)
> {
> assert(fontname != 0 /* nullptr */);
> [...]
> } else if (strcmp(fontname, "CR") == 0) {
> if ((! fill_on)
> && is_courier_until_eol()
> && is_line_start(! fill_on)) {
> current_paragraph->do_pre();
> }
> current_paragraph->do_tt();
> [...]
> }
> }
>
> So that should work, right? CR is meant to turn into a <pre> or <tt>
> tag depending on the context. But even with current git master, it
> doesn't seem to:
>
> $ cat t.1
> .TH T 1
> .SH NAME
> t \- a test
> .SH DESCRIPTION
> .ft CR
> constant-width text
> $ ./test-groff -ww -man -Thtml t.1
> [...]
> <p style="margin-left:6%; margin-top: 1em">constant-width
> text</p>
>
> So there's no warning, but also no actual constant-width output. Am I
> holding it wrong somehow, or is this broken?
Nope. It's broken.
I don't see a Savannah ticket for this, but I recall complaining
exasperatedly to this list[1] (or maybe to some Savannah ticket that
_does_ exist) about grohtml's crude technique of employing <pre>
sometimes, when that implies too much (more than a change of typeface),
and failing to switch the typeface at all at other times.
Regards,
Branden
[1] I'd search, but Web connections to lists.gnu.org/archive are once
again timing out for me.
signature.asc
Description: PGP signature
