gbranden pushed a commit to branch master
in repository groff.
commit 9f74f96746bc3e6eef825788a815bc91cc3e2758
Author: G. Branden Robinson <[email protected]>
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 <[email protected]>
+
+ [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 <[email protected]>
* 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) {
_______________________________________________
Groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit