bugGNU roff - Bugs: bug #64862, [tbl] clobbers value of previously...

 
 

bug #64862: [tbl] clobbers value of previously selected font

Submitter:  G. Branden Robinson <gbranden>
Submitted:  Sun 05 Nov 2023 10:10:08 PM UTC
   
 
Category:  Preprocessor tbl 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
   

Mon 27 Nov 2023 08:10:45 PM UTC, comment #2: 

My example of potential environment usage in comment #1 was a bit muddled.

Here's something that may be less so.


.TS
.nr 3tbl*saved-environment \n[.ev]
.ev 3tbl*environment
.evc \n[3tbl*saved-environment]
...
.ev
.TE


G. Branden Robinson <gbranden>
Group administrator
Fri 10 Nov 2023 06:15:04 AM UTC, comment #1: 

We could solve this the way we save other things in tbl: by creating registers and laboriously populating and restoring from them.

But there are a lot of "previous-value" parameters that would require this approach.

  • previously selected font mounting position (this one)
  • previous default font family
  • previous fill color
  • previous stroke color
  • previous indentation amount
  • previous line length
  • previous additional interline skip amount ("line spacing")
  • previous title line length
  • previous page offset
  • previous type size
  • previous post-vertical line spacing
  • previous vertical spacing


While conceptually straightforward to do, the quantity of manual operations implied here suggests that it's a poor approach.

Further, off the top of my head, all of these are properties of the environment.

I therefore reiterate that it would probably be a good idea if GNU tbl produced output that created an environment for each table region.

So, input like this:


.TS
L.
hello
.TE


...would become something like this.


.TS
.ev 3tbl*environment
.evc \n[.ev]
...
.ev
.TE


Hmm, maybe James Clark hadn't invented the `.ev` register yet at the time he implemented GNU tbl.  I think I've speculated elsewhere that maybe he was trying to keep AT&T compatible output.  (That would explain why the name of every *roff object handled by GNU tbl has its name indirected through a C/C++ preprocessor macro.)  But it would appear that once the bridge was crossed to using long names for these, no one ever went back.  There's no mention I know of for a build option to use AT&T-legal names in GNU tbl output, and  as far as I recall, no support in GNU tbl code for generating AT&T-compatible escape sequences (e.g., `\n(xx` vs. `\n[.xx]`).

Anyway.  To solve this I think creating an environment is the way to go.

Urgency is not high.  As far as I know I am the first person to ever complain about this.

https://github.com/NetHack/NetHack/commit/9658f6769d1bded85f72e7b5b0f6a0841ef3604b

G. Branden Robinson <gbranden>
Group administrator
Sun 05 Nov 2023 10:10:08 PM UTC, original submission:  

Input:


$ cat does-tbl-preserve-font-selections.roff
.ft 2
.nr p \n(.f
.ft 3
.nr c \n(.f
Font selections before tbl: previous=\np, current=\nc
.ft
2 ?= \n(.f
.ft
.br
before table, font is \n(.f
.TS
box;
Lf(CR).
This is a table.
.TE
after table, font is \n(.f
.br
.nr c \n(.f
.ft
.nr p \n(.f
Font selections after tbl: previous=\np, current=\nc


Output:


$ nroff -t -Tascii EXPERIMENTS/does-tbl-preserve-font-selections.roff | cat -s
troff:EXPERIMENTS/does-tbl-preserve-font-selections.roff:14: warning: cannot select font 'CR'
troff:EXPERIMENTS/does-tbl-preserve-font-selections.roff:14: warning: cannot select font 'CR'
Font selections before tbl: previous=2, current=3 2 ?= 2
before table, font is 3
+------------------+
| This is a table. |
+------------------+
after table, font is 3
Font selections after tbl: previous=3, current=3


I expect GNU tbl to put things back the way they were before the table region.

For what it's worth, DWB and Heirloom Doctools tbl don't, either.

G. Branden Robinson <gbranden>
Group administrator

 

(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 (Submitted the item)
  •  

    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.

     

    No changes have been made to this item

    Back to the top

    Powered by Savane 3.13-58d6.
    Corresponding source code