groff-commit
[Top][All Lists]
Advanced

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

[groff] 16/28: [me]: Add nroff mode fallback for `u` macro.


From: G. Branden Robinson
Subject: [groff] 16/28: [me]: Add nroff mode fallback for `u` macro.
Date: Mon, 14 Feb 2022 01:46:59 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit 992a8e690eb4c7955c35f8606e9d44b0abf0e72f
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sat Feb 12 17:18:12 2022 +1100

    [me]: Add nroff mode fallback for `u` macro.
    
    * tmac/e.tmac (u): On nroff devices, bracket the first argument with
      \(ul (underline rule) special character escape sequences.  (In plain
      language, '.u "like this"' renders "_like this_".)
    
      I regard this as a cosmetic and semantic improvement; since the
      quarter-em vertical motions used in troff mode were ignored in nroff
      mode, the effect was not underlining but a sort of strike-through,
      visible only at spaces in the argument.  The use of this macro was
      thus invisible in nroff output if no spaces were present in the
      argument.  This is probably the best we can do without a fatter
      interface to terminal device capabilities.
    
    Add comments explaining trade-offs between the approaches.  N.B.,
    meref.me explicitly disclaims support for `u` arguments that require
    adjustment or breaking (and as far as I can tell, it always has); this
    is all a matter of best-effort rendering.
---
 ChangeLog   | 16 ++++++++++++++++
 tmac/e.tmac | 14 +++++++++++---
 2 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 8e12e051..7407ff62 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2022-02-12  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       [me]: Add nroff mode fallback for `u` macro.
+
+       * tmac/e.tmac (u): On nroff devices, bracket the first argument
+       with \(ul (underline rule) special character escape sequences.
+       {In plain language, '.u "like this"' renders "_like this_".}
+
+       I regard this as a cosmetic and semantic improvement; since the
+       quarter-em vertical motions used in troff mode were ignored in
+       nroff mode, the effect was not underlining but a sort of
+       strike-through, visible only at spaces in the argument.  The use
+       of this macro was thus invisible in nroff output if no spaces
+       were present in the argument.  This is probably the best we can
+       do without a fatter interface to terminal device capabilities.
+
 2022-02-12  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        [me]: Simulate boxed text support on nroff devices with ISO 6429
diff --git a/tmac/e.tmac b/tmac/e.tmac
index b73680a0..fc53458b 100644
--- a/tmac/e.tmac
+++ b/tmac/e.tmac
@@ -1547,13 +1547,21 @@
 ..
 .
 .de u                  \" *** enter underlined word
-\&\\$1\l'|0\(ul'\\$2
+.\" If the first argument would break, then (in troff mode), this
+.\" underlines only the words appearing only the last output line, with
+.\" the underline extending all the way into the left margin.
+.ie t \\$1\l'|0\(ul'\\$2
+.el \(ul\\$1\(ul\\$2
 ..
 .
-.\" a better version of u
+.\" This alternative version of the `u` macro uses the groff \Z
+.\" extension to get the underlining to accurately fit under the words
+.\" at the expense of no longer adjusting them.  If the first argument
+.\" would break, the output line is overset.
 .if !\n(.g .ig
 .de u
-\Z'\\$1'\v'.25m'\D'l \w'\\$1'u 0'\v'-.25m'\\$2
+.ie t .do nop \Z'\\$1'\v'.25m'\D'l \w'\\$1'u 0'\v'-.25m'\\$2
+.el \(ul\\$1\(ul\\$2
 ..
 .
 .de q                  \" *** enter quoted word



reply via email to

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