groff-commit
[Top][All Lists]
Advanced

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

[groff] 08/11: [man]: Apply italic corrections more consistently.


From: G. Branden Robinson
Subject: [groff] 08/11: [man]: Apply italic corrections more consistently.
Date: Mon, 17 May 2021 23:02:49 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit e58e32ea308ac5d344b3c79b20d7f4ab2456377b
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Tue May 18 09:25:21 2021 +1000

    [man]: Apply italic corrections more consistently.
    
    * tmac/an-old.tmac (BI, IB, IR, RI): Apply italic corrections more
      consistently.  Add lengthy comment rationalizing approach.
    
      (RI, BI): An italic correction is now applied after the last argument
      if it is of even parity (i.e., the 2nd, 4th, 6th, ...).
    
    * tmac/groff_man.7.man.in (Description/Font style macros): Note that
      italic corrections are applied.
    
    Fixes <https://savannah.gnu.org/bugs/index.php?53541>.
    
    Thanks to Bjarni Ingi Gislason for the report and a suggested patch.
---
 ChangeLog               | 17 ++++++++++++++++
 tmac/an-old.tmac        | 52 +++++++++++++++++++++++++++++++++++++++----------
 tmac/groff_man.7.man.in |  2 ++
 3 files changed, 61 insertions(+), 10 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 5971c8b..38dee9c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2021-05-18  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       [man]: Apply italic corrections more consistently.
+
+       * tmac/an-old.tmac (BI, IB, IR, RI): Apply italic corrections
+       more consistently.  Add lengthy comment rationalizing approach.
+       (RI, BI): An italic correction is now applied after the last
+       argument if it is of even parity (i.e., the 2nd, 4th, 6th, ...).
+
+       * tmac/groff_man.7.man.in (Description/Font style macros): Note
+       that italic corrections are applied.
+
+       Fixes <https://savannah.gnu.org/bugs/index.php?53541>.
+
+       Thanks to Bjarni Ingi Gislason for the report and a suggested
+       patch.
+
 2021-05-17  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        [man]: Ignore FT register when appropriate.
diff --git a/tmac/an-old.tmac b/tmac/an-old.tmac
index 1a9ccb0..735bb7d 100644
--- a/tmac/an-old.tmac
+++ b/tmac/an-old.tmac
@@ -513,6 +513,38 @@
 .  ns
 ..
 .
+.\" The italic correction escapes can be visually confusing.  We apply
+.\" the following rules, always on the same input line.
+.\"   (1) Before any italic argument, emit a left italic correction \,
+.\"       before switching to the italic style.
+.\"   (2) After any italic argument, emit an italic correction \/
+.\"       before switching to another style.
+.\"
+.\" It is true that these macros cannot know what style is used in the
+.\" input stream before or after they are called.  We can make
+.\" assumptions based on pragmatics.  In most cases, the caller will not
+.\" precede a call to one of these macros with \c, or add it to the
+.\" final argument given to one of these calls; when \c is absent, what
+.\" is adjacent must be a word space or output line boundary, so italic
+.\" corrections don't matter.  If \c _is_ used by the caller, we can
+.\" assume that the adjacent glyphs before an IB or IR call, or the
+.\" following ones after a BI or RI call, will not be italic (and thus
+.\" will benefit from the italic correction we provide); otherwise the
+.\" caller would simply have added the relevant characters to the
+.\" arguments of the macro call.
+.\"
+.\" Unrelatedly,
+.\"   (3) Emit a non-printing input break \& before the first argument.
+.\"       This is necessary only when the calling man page is in
+.\"       compatibility mode; it works around the surprising AT&T
+.\"       semantics of \f escapes at the beginning of an input line.
+.\"       See "Implementation differences" in groff_diff(7) or the groff
+.\"       Texinfo manual.)
+.\"   (4) Prefix the string argument to an 'as' request with a double
+.\"       quote (") if it begins with a macro argument interpolation
+.\"       (which might start with a space).  (This would apply to 'ds'
+.\"       as well but for item (3) above.)
+.
 .de1 RI
 .  if (\\n[.$] < 2) \
 .    an-style-warn .\\$0 expects at least 2 arguments, got \\n[.$]
@@ -520,10 +552,10 @@
 .    ds an-result \&\f[R]\\$1\"
 .    shift
 .    while (\\n[.$] >= 2) \{\
-.      as an-result \,\f[I]\\$1\f[R]\/\\$2\"
+.      as an-result \,\f[I]\\$1\/\f[R]\\$2\"
 .      shift 2
 .    \}
-.    if \\n[.$] .as an-result \,\f[I]\\$1\"
+.    if \\n[.$] .as an-result \,\f[I]\\$1\/\"
 \\*[an-result]
 .    ft R
 .  \}
@@ -533,13 +565,13 @@
 .  if (\\n[.$] < 2) \
 .    an-style-warn .\\$0 expects at least 2 arguments, got \\n[.$]
 .  if \\n[.$] \{\
-.    ds an-result \&\f[I]\,\\$1\f[R]\"
+.    ds an-result \&\,\f[I]\\$1\/\f[R]\"
 .    shift
 .    while (\\n[.$] >= 2) \{\
-.      as an-result \/\\$1\f[I]\,\\$2\f[R]\"
+.      as an-result "\\$1\,\f[I]\\$2\/\f[R]\"
 .      shift 2
 .    \}
-.    if \\n[.$] .as an-result \/\\$1\"
+.    if \\n[.$] .as an-result "\\$1\"
 \\*[an-result]
 .    ft R
 .  \}
@@ -549,13 +581,13 @@
 .  if (\\n[.$] < 2) \
 .    an-style-warn .\\$0 expects at least 2 arguments, got \\n[.$]
 .  if \\n[.$] \{\
-.    ds an-result \&\f[I]\,\\$1\"
+.    ds an-result \&\,\f[I]\\$1\/\"
 .    shift
 .    while (\\n[.$] >= 2) \{\
-.      as an-result \/\f[B]\\$1\f[I]\,\\$2\"
+.      as an-result \f[B]\\$1\,\f[I]\\$2\/\"
 .      shift 2
 .    \}
-.    if \\n[.$] .as an-result \/\f[B]\\$1\"
+.    if \\n[.$] .as an-result \f[B]\\$1\"
 \\*[an-result]
 .    ft R
 .  \}
@@ -568,10 +600,10 @@
 .    ds an-result \&\f[B]\\$1\"
 .    shift
 .    while (\\n[.$] >= 2) \{\
-.      as an-result \,\f[I]\\$1\f[B]\/\\$2\"
+.      as an-result \,\f[I]\\$1\/\f[B]\\$2\"
 .      shift 2
 .    \}
-.    if \\n[.$] .as an-result \,\f[I]\\$1\"
+.    if \\n[.$] .as an-result \,\f[I]\\$1\/\"
 \\*[an-result]
 .    ft R
 .  \}
diff --git a/tmac/groff_man.7.man.in b/tmac/groff_man.7.man.in
index bf8fbe9..b80d2b5 100644
--- a/tmac/groff_man.7.man.in
+++ b/tmac/groff_man.7.man.in
@@ -1478,6 +1478,8 @@ Unlike the above font style macros,
 the font style alternation macros below accept only arguments on the
 same line as the macro call.
 .
+Italic corrections are applied as appropriate.
+.
 If space is required within one of the arguments,
 first consider whether the same result could be achieved with as much
 clarity by using the single-style macros on separate input lines.



reply via email to

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