groff-commit
[Top][All Lists]
Advanced

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

[groff] 44/46: [tbl]: Expose boxedness via a troff register.


From: G. Branden Robinson
Subject: [groff] 44/46: [tbl]: Expose boxedness via a troff register.
Date: Wed, 7 Dec 2022 04:32:38 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit 9f74f96746bc3e6eef825788a815bc91cc3e2758
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Wed Dec 7 01:30:21 2022 -0600

    [tbl]: Expose boxedness via a troff register.
    
    [tbl]: Expose the fact of a table's boxedness via a troff register so
    that macro packages can make more intelligent decisions about space
    requirements (since box borders occupy significant space on nroff
    devices).
    
    * src/preproc/tbl/table.cpp: Define new preprocessor macro,
      `IS_BOXED_REG`.
    
      (table::do_top): Initialize "boxedness" register.
    
    We could make this an official bit of API, say, by calling it `TB`.  But
    for now the name is internal and groffish.
---
 ChangeLog                 | 11 +++++++++++
 src/preproc/tbl/table.cpp |  5 +++++
 2 files changed, 16 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index c6ba50145..a27fd5a51 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2022-12-07  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       [tbl]: Expose the fact of a table's boxedness via a troff
+       register so that macro packages can make more intelligent
+       decisions about space requirements (since box borders occupy
+       significant space on nroff devices).
+
+       * src/preproc/tbl/table.cpp: Define new preprocessor macro,
+       `IS_BOXED_REG`.
+       (table::do_top): Initialize "boxedness" register.
+
 2022-12-07  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * tmac/s.tmac (TH): Clarify computation and diagnostic message.
diff --git a/src/preproc/tbl/table.cpp b/src/preproc/tbl/table.cpp
index 049caa87e..10c2738bd 100644
--- a/src/preproc/tbl/table.cpp
+++ b/src/preproc/tbl/table.cpp
@@ -68,6 +68,7 @@ const int DEFAULT_COLUMN_SEPARATION = 3;
 #define SAVED_NUMBERING_LINENO PREFIX "linenumber"
 #define SAVED_NUMBERING_SUPPRESSION_COUNT PREFIX "linenumbersuppresscnt"
 #define STARTING_PAGE_REG PREFIX "startingpage"
+#define IS_BOXED_REG PREFIX "is-boxed"
 
 // this must be one character
 #define COMPATIBLE_REG PREFIX "c"
@@ -2949,6 +2950,10 @@ void table::do_top()
   prints(".\\\" do top\n");
   prints(".ss \\n[" SAVED_INTER_WORD_SPACE_SIZE "]\n");
   prints(".fc \002\003\n");
+  if (flags & (BOX | DOUBLEBOX | ALLBOX))
+    prints(".nr " IS_BOXED_REG " 1\n");
+  else
+    prints(".nr " IS_BOXED_REG " 0\n");
   if (!(flags & NOKEEP) && (flags & (BOX | DOUBLEBOX | ALLBOX)))
     prints("." TABLE_KEEP_MACRO_NAME "\n");
   if (flags & DOUBLEBOX) {



reply via email to

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