bugGNU roff - Bugs: bug #61915, grohtml: .EX/.EE is not monospaced

 
 

bug #61915: grohtml: .EX/.EE is not monospaced

Submitter:  None
Submitted:  Tue 25 Jan 2022 12:10:45 PM UTC
   
 
Category:  Preprocessor html Severity:  3 - Normal
Item Group:  Incorrect behaviour Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 08 Sep 2022 06:34:38 AM UTC, comment #3: 

Nothing clears the mind like posting an embarrassing ramble publicly.

What the report complains of is the handling of the EX/EE macros.

What I used to test presence of the Courier typeface in output was a tbl(1) table that selected the Courier roman font.

These are not the same thing.

The problem seems to be much simpler, and indeed is present in groff 1.22.4

Ya wanna know what grohtml does when you request a Courier family font?

It opens a "<pre>" tag.

My eyebrow just about arched through the ceiling.

Whatever other complaints we may have about this, it explains why grohtml honors \f[CR] and .ft CR but not .fam.

Check this out.


$ cat EXPERIMENTS/EX-EE.man
.TH foo 1 2022-09-08 "groff test suite"
.EX
baz
.EE
.nf
.fam C
qux
.fam T
\f[CR]barR
\f[CI]barI
\f[CB]barB
\f[CBI]barBI
.ft CR
gakR
.ft CB
gakB
.ft CI
gakI
.ft CBI
gakBI
$ ./build/test-groff -Thtml -man EXPERIMENTS/EX-EE.man | tail -n 11
<pre>barR
<i>barI
</i><b>barB
</b><i><b>barBI
</b></i>gakR
<b>gakB
</b><i>gakI
</i><i><b>gakBI</b></i></pre>
<hr>
</body>
</html>


So that's why .EX/.EE is not monospaced.  I suspect a better approach would be to produce <div> or <span> tags with style attributes.

G. Branden Robinson <gbranden>
Group administrator
Thu 08 Sep 2022 06:19:03 AM UTC, comment #2: 


comment #1:

> I think I found the cause of this.  It's some code I added to an.tmac.


This isn't quite true.  Font remappings like that have been present since 2007.  They formerly resided in the an-ext.tmac file.

https://git.savannah.gnu.org/cgit/groff.git/commit/?id=259929625b21595951ed3ef5dba9aaaea359b464

Consider the following simple reproducer.


$ cat EXPERIMENTS/courier-in-table.man
.TH foo 1 2022-09-08 "groff test suite"
.TS
Lf(CR).
baz
.TE


The puzzling bit is that you could still get the Courier family in tbl(1) tables anyway up through groff 1.22.4; the above example works in released groff.  It is only since then that that regressed--almost surely my fault, but it's hard for me to reason out why.  It's fairly well-known that groff's html output devices transform tbl tables and (sometimes) eqn equations into PostScript (using groff again) and then convert that output to image files which are then linked from the HTML output.

But since 'ps' is not an nroff device (it's troff), the font remappings would not have taken place.  This explains why Courier shows up in the table.  But I haven't hacked on grops much, and if I'd broken its ability to change font families I'd have noticed long before now.

Weirder still, the following fix works.


diff --git a/tmac/an.tmac b/tmac/an.tmac
index 90ccb67fc..f4f9d28a3 100644
--- a/tmac/an.tmac
+++ b/tmac/an.tmac
@@ -1158,8 +1158,9 @@ contains unsupported escape sequence
 .ds an*body-family T \" Times
 .ds an*example-family C \" Courier
 .
-.\" Map monospaced fonts to standard styles for groff's nroff devices.
-.if n \{\
+.\" Map monospaced fonts to standard styles for groff's nroff devices,
+.\" except HTML, which _can_ change font families.
+.if !\n[an-is-output-html] .if n \{\
 .  ftr CR R
 .  ftr CI I
 .  ftr CB B


But given my analysis above, this should not have fixed the bug at all--the missing conditional has been missing since groff 1.20.  And yet it does.

Very mysterious.

G. Branden Robinson <gbranden>
Group administrator
Thu 08 Sep 2022 05:26:42 AM UTC, comment #1: 

I think I found the cause of this.  It's some code I added to an.tmac.

https://git.savannah.gnu.org/cgit/groff.git/tree/tmac/an.tmac#n1161

At the time, I did not know that groff declared {x,}html to be "nroff devices".  I am dubious of that decision but in any case, now I do.

G. Branden Robinson <gbranden>
Group administrator
Tue 25 Jan 2022 12:10:45 PM UTC, original submission:  

Original report in the mailing list:
<https://lists.gnu.org/archive/html/groff/2022-01/msg00017.html>


While -T pdf correctly renders .EX/.EE in a monospace font, -T html
doesn't use a monospace font for those blocks.

You can see the source code at
<http://www.alejandro-colomar.es/src/alx/alx/games/chessutils.git/tree/share/man/man6/chess-mv.6>
and the html page at
<http://www.alejandro-colomar.es/man/man6/chess-mv.6.html>.

See there the EXAMPLES section.

The HTML source code produced by groff(1) doesn't seem to have any
marker to require a monospace font.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by gbranden (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-09-08 gbranden StatusIn Progress None
    2022-09-08 gbranden StatusNone In Progress

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code