groff-commit
[Top][All Lists]
Advanced

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

[groff] 28/46: tmac/fallbacks.tmac: Work around ".if t" problem.


From: G. Branden Robinson
Subject: [groff] 28/46: tmac/fallbacks.tmac: Work around ".if t" problem.
Date: Wed, 7 Dec 2022 04:32:36 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit 230ad718f67621c02143c6f18031978d1f98c63a
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sat Dec 3 22:23:51 2022 -0600

    tmac/fallbacks.tmac: Work around ".if t" problem.
    
    * tmac/fallbacks.tmac: Really use troff-mode fallbacks only on
      typesetting devices; because this macro file is loaded so early, we
      cannot rely on ".if t".  Thanks to Dave Kemper for the discussion in
      Savannah #63354.
---
 ChangeLog           |  7 +++++++
 tmac/fallbacks.tmac | 22 ++++++++++++++++++----
 2 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index c7e939c40..f407b9a75 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,13 @@
        * tmac/tests/an_link-trailing-text-hugs-previous.sh: Do it.
        * tmac/tmac.am (tmac_TESTS): Run test.
 
+2022-12-03  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * tmac/fallbacks.tmac: Really use troff-mode fallbacks only on
+       typesetting devices; because this macro file is loaded so early,
+       we cannot rely on ".if t".  Thanks to Dave Kemper for the
+       discussion in Savannah #63354.
+
 2022-12-03  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * tmac/an-ext.tmac: Use more mnemonic register names, thanks to
diff --git a/tmac/fallbacks.tmac b/tmac/fallbacks.tmac
index 9ba22c0f5..aee549d81 100644
--- a/tmac/fallbacks.tmac
+++ b/tmac/fallbacks.tmac
@@ -8,6 +8,14 @@
 .do nr *groff_fallbacks_tmac_C \n[.cp]
 .cp 0
 .
+.\" The early loading observation above also means that the conditional
+.\" expressions 'n' and 't' are not reliable.  Define ersatz substitute.
+.nr fallbacks*troff-mode 1
+.if '\*[.T]'ascii'  .nr fallbacks*troff-mode 0
+.if '\*[.T]'cp1047' .nr fallbacks*troff-mode 0
+.if '\*[.T]'latin1' .nr fallbacks*troff-mode 0
+.if '\*[.T]'utf8'   .nr fallbacks*troff-mode 0
+.
 .\" MODIFIER LETTER CIRCUMFLEX ACCENT -> CIRCUMFLEX ACCENT
 .fchar \[u02C6] ^
 .\" SMALL TILDE -> TILDE
@@ -156,13 +164,16 @@
 .fchar \[u200B] \h'0'\" zero-width space
 .fchar \[u2010] -\:\" hyphen
 .fchar \[u2011] -\" non-breaking hyphen (won't break w/o .hcode or \:)
-.ie t .fchar \[u2012] \v'-.3m'\l'\w"\0"u\[ru]'\v'+.3m'\" figure dash
-.el   .fchar \[u2012] \-
+.ie \n[fallbacks*troff-mode] \
+.  fchar \[u2012] \v'-.3m'\l'\w"\0"u\[ru]'\v'+.3m'\" figure dash
+.el \
+.  fchar \[u2012] \-
 .fchar \[u2013] \[en]\" en dash
 .fchar \[u2014] \[em]\" em dash
 .fchar \[u2015] \[em]\" horizontal bar (quotation dash)
 .fchar \[u2016] ||\" double vertical line (matrix norm)
-.if t .fchar \[u2017] \Z'\[ul]'\v'+.1m'\[ul]\v'-.1m'\" double low line
+.if \n[fallbacks*troff-mode] \
+.  fchar \[u2017] \Z'\[ul]'\v'+.1m'\[ul]\v'-.1m'\" double low line
 .fchar \[u2018] \[oq]\" left single quotation mark
 .fchar \[u2019] \[cq]\" right single quotation mark
 .fchar \[u201C] \[lq]\" left double quotation mark
@@ -180,12 +191,15 @@
 .fchar \[u2033] \[sd]\" double prime
 .fchar \[u2039] \[fo]\" left single chevron
 .fchar \[u203A] \[fc]\" right single chevron
-.if t .fchar \[u203D] \o'?!'\" interrobang
+.if \n[fallbacks*troff-mode] \
+.  fchar \[u203D] \o'?!'\" interrobang
 .\"fchar \[u203E] \[rn]\" overline \" Savannah #63332 again
 .fchar \[u2044] \[f/]\" fraction slash
 .fchar \[u2052] %\" commercial minus sign
 .fchar \[u2053] \[ti]\" swung dash
 .
+.rr fallbacks*troff-mode
+.
 .cp \n[*groff_fallbacks_tmac_C]
 .do rr *groff_fallbacks_tmac_C
 .



reply via email to

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