groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: The 3-faces problem


From: G. Branden Robinson
Subject: Re: The 3-faces problem
Date: Mon, 22 Nov 2021 18:08:43 +1100
User-agent: NeoMutt/20180716

Hi, Alex!

At 2021-11-02T19:07:05+0100, Alejandro Colomar (man-pages) wrote:
> I was using xface termincal, but I tried on xterm after your email and
> see the same result.  IF you have a big enough font size and print
> them almost together, you'll be able to see the difference:
> 
> $ cat underscore.7test
> .TH UNDERSCORE 7TEST today
> .SH UNDERSCORE
> .RB [ U ] INT \fIN\fP _WI_DTH RO_MAN
> 
> There are 3 different underscores: italics, bold, and roman,
> respectiely.  At least with the less pager.  more doesn't even
> highlight, so I can't test with a different pager.
> 
> I used `man ./underscore.7`.

You might want to make sure man(1) isn't confounding the issue--or that
a vendor release of groff isn't.  Before I get to that I'll share my
output.

I don't see 3 different underscores, just 2.  I don't trust my ageing
eyes, however, so I checked a hex dump.

$ groff -T utf8 -man EXPERIMENTS/underscore-colomar.7 | xxd
00000000: 554e 4445 5253 434f 5245 2837 5445 5354  UNDERSCORE(7TEST
00000010: 2920 2020 2020 2020 2020 2020 2020 2020  )               
00000020: 2020 2020 2020 2020 2020 2020 2020 2020                  
00000030: 2020 2020 2020 2020 2020 2020 2055 4e44               UND
00000040: 4552 5343 4f52 4528 3754 4553 5429 0a0a  ERSCORE(7TEST)..
00000050: 0a0a 1b5b 316d 554e 4445 5253 434f 5245  ...[1mUNDERSCORE
00000060: 1b5b 306d 0a20 2020 2020 2020 5b1b 5b31  .[0m.       [.[1
00000070: 6d55 1b5b 3232 6d5d 1b5b 316d 494e 541b  mU.[22m].[1mINT.
00000080: 5b34 6d1b 5b32 326d 4e1b 5b32 346d 1b5b  [4m.[22mN.[24m.[
00000090: 316d 5f57 495f 4454 481b 5b32 326d 524f  1m_WI_DTH.[22mRO
000000a0: 5f4d 414e 0a0a 0a0a 2020 2020 2020 2020  _MAN....        
000000b0: 2020 2020 2020 2020 2020 2020 2020 2020                  
000000c0: 2020 2020 2020 2020 2020 2020 2074 6f64               tod
000000d0: 6179 2020 2020 2020 2020 2020 2020 2020  ay              
000000e0: 2020 2020 2055 4e44 4552 5343 4f52 4528       UNDERSCORE(
000000f0: 3754 4553 5429 0a                        7TEST).

(This is groff 1.22.4 as shipped by Debian, which somewhat notoriously
messes with grotty's SGR default when the groff man(7) macro package is
used[1].  I've changed my /etc/man.local to conform with groff
upstream.)

We can see from the above that no escape sequence is emitted between the
first and second underscores.

Nor, given the semantics of the 'RB' macro and the input, would I expect
there to be.

> .RB [ U ] INT \fIN\fP _WI_DTH RO_MAN

I think it is pretty clear that both underscores in "_WI_DTH" should
render in the same style.  To figure out which, admittedly you have to
count arguments (you can just count mod 2 as in "eeny meeny miney moe"
if you want to be sophisticated about it ;-) ).

Maybe I found the problem.  If I run "groff -man -P-c | less -R" inside
script(1), to defeat less(1)'s valiant attempts to hide from me the
escape sequences it outputs to the terminal, and then hex dump the
result, I see (among irrelevant output) the following.

00000400: 554e 4445 5253 434f 5245 2837 5445 5354  UNDERSCORE(7TEST
00000410: 2920 2020 2020 2020 2020 2020 2020 2020  )               
00000420: 2020 2020 2020 2020 2020 2020 2020 2020                  
00000430: 2020 2020 2020 2020 2020 2020 2055 4e44               UND
00000440: 4552 5343 4f52 4528 3754 4553 5429 1b5b  ERSCORE(7TEST).[
00000450: 6d0d 0a1b 5b6d 0d0a 1b5b 6d0d 0a1b 5b6d  m...[m...[m...[m
00000460: 0d0a 1b5b 316d 554e 4445 5253 434f 5245  ...[1mUNDERSCORE
00000470: 1b5b 306d 1b5b 6d0d 0a20 2020 2020 2020  .[0m.[m..       
00000480: 5b1b 5b31 6d55 1b5b 306d 5d1b 5b31 6d49  [.[1mU.[0m].[1mI
00000490: 4e54 1b5b 306d 1b5b 346d 4e5f 1b5b 3234  NT.[0m.[4mN_.[24
000004a0: 6d1b 5b31 6d57 495f 4454 481b 5b30 6d52  m.[1mWI_DTH.[0mR
000004b0: 4f5f 4d41 4e1b 5b6d 0d0a 1b5b 6d0d 0a1b  O_MAN.[m...[m...
000004c0: 5b6d 0d0a 1b5b 6d0d 0a20 2020 2020 2020  [m...[m..       
000004d0: 2020 2020 2020 2020 2020 2020 2020 2020                  
000004e0: 2020 2020 2020 2020 2020 2020 2020 746f                to
000004f0: 6461 7920 2020 2020 2020 2020 2020 2020  day             
00000500: 2020 2020 2020 554e 4445 5253 434f 5245        UNDERSCORE
00000510: 2837 5445 5354 291b 5b6d 0d0a 1b5b 376d  (7TEST).[m...[7m

Addresses 0x490 through 0x4af are of particular interest.

We see at 0x49c that underlining is turned off, and at 0x4a1 that bold
is turned on[2].  So in contrast to the earlier output above, the two
underscores in "_WI_DTH" *are* in fact formatted differently.

My guess is that what is happening here is a combination of (A) Debian's
default of forcing grotty(1) to its legacy output mode when rendering
man pages and (B) less(1)'s heuristic about how ambiguous legacy output
sequences should be formatted guessing wrongly.  I've made explicit
notice of this in a recent groff commit.[3]

I acknowledge that people have thundered with fundamentalist fervor[4]
for years about how legacy output is better, but their preferences
simply do not align with what nearly all terminal emulators--on Unix or
perhaps anywhere--do or were designed to do.  Terminal emulators on Unix
were written mostly to emulate video terminals[5], not Teletype
machines.  Such paper-based devices could progressively saturate paper
with ink and therefore had, in practice, multiple "intensity" levels as
well as true glyph overstriking.  Space would appear to exist for a
teletypewriter analogue of CoolRetroTerm[6], for those who want to view
their Unix manuals as Ken and Dennis would--nay, MUST--have
preferred[4][6][8].

Regards,
Branden

[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=963490
[2] https://invisible-island.net/xterm/ctlseqs/ctlseqs.html
[3] 
https://git.savannah.gnu.org/cgit/groff.git/commit/?id=469ef4fb84ac41a1db430dcf09ee52e9683332c3
[4] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=312935
[5] I note xterm's storage-tube display emulation mode for the Tektronix
    4014, and that it doesn't affect the argument.
[6] I know what would happen with these people.  You could post a
    15-second TikTok video of Ken Thompson himself happily clicking
    through Deri James's WebManPDF site[7], and after about the same
    interval of their faces bluescreening, you'd hear from them
    about how even the greatest among us can flag in their fidelity to
    rightness, and that it's up to the Pure Few possessed of Truth to
    keep the Faith in the Eternal Model 37.
[7] http://chuzzlewit.co.uk/WebManPDF.pl/man:/1/groff
[8] The appellants to authority in these case always seem to labor in
    complete ignorance of the Blit terminal[9].  My guess is that this
    is because the Blit came just a little too late, after these
    intellectual feudalists shifted their vassalage from Thompson and
    Ritchie to Bill Joy.  Why?  Because Joy was better at making money.
[9] https://en.wikipedia.org/wiki/Blit_(computer_terminal)

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]