groff-commit
[Top][All Lists]
Advanced

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

[groff] 51/54: tmac/s.tmac: Make FAM string work more sensibly.


From: Keith Marshall
Subject: [groff] 51/54: tmac/s.tmac: Make FAM string work more sensibly.
Date: Sat, 23 Oct 2021 16:57:37 -0400 (EDT)

keithmarshall pushed a commit to branch dev-gropdf-boxes
in repository groff.

commit fd15f9f61f199f51559195546e3abcc827023331
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Wed Apr 21 04:28:52 2021 +1000

    tmac/s.tmac: Make FAM string work more sensibly.
    
    * tmac/s.tmac: Make the FAM string work more sensibly; it now applies to
      headers, footers, and footnotes only if set before the first call of a
      sectioning, paragraphing, or (non-date) document description macro.
    
      (PT, BT): Set the font family to that saved for titles.
    
      (fn*do-FS): Set the font family to that saved for footnotes.
    
      (par@init): Copy the document font family to independent strings for
      titles and footnotes.
    
      (par@reset): If in a footnote environment, set the font family to that
      saved for footnotes; otherwise use \*[FAM].
    
    * tmac/groff_ms.7.man (Differences from troff ms/Text settings):
      Describe placement-dependent effect of FAM string setting.
    
    * doc/groff.texi (Highlighting in ms):
    * doc/ms.ms (Highlighting): As above, and suggest different occasions in
      which ".ds FAM C" and "CW" are convenient.
    
    Fixes <https://savannah.gnu.org/bugs/?60422>.
---
 ChangeLog           | 22 ++++++++++++++++++++++
 doc/groff.texi      | 17 ++++++++++++-----
 doc/ms.ms           | 52 ++++++++++++++++++++++++++++++++++++++--------------
 tmac/groff_ms.7.man | 15 +++++++++++++--
 tmac/s.tmac         |  8 +++++++-
 5 files changed, 92 insertions(+), 22 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 86be337..ce6085b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+2021-04-21  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * tmac/s.tmac: Make the FAM string work more sensibly; it now
+       applies to headers, footers, and footnotes only if set
+       before the first call of a sectioning, paragraphing, or
+       {non-date} document description macro.
+       (PT, BT): Set the font family to that saved for titles.
+       (fn*do-FS): Set the font family to that saved for footnotes.
+       (par@init): Copy the document font family to independent strings
+       for titles and footnotes.
+       (par@reset): If in a footnote environment, set the font family
+       to that saved for footnotes; otherwise use \*[FAM].
+
+       * tmac/groff_ms.7.man (Differences from troff ms/Text settings):
+       Describe placement-dependent effect of FAM string setting.
+
+       * doc/groff.texi (Highlighting in ms):
+       * doc/ms.ms (Highlighting): As above, and suggest different
+       occasions in which ".ds FAM C" and "CW" are convenient.
+
+       Fixes <https://savannah.gnu.org/bugs/?60422>.
+
 2021-04-19  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * src/roff/troff/input.cpp (source, source_quietly,
diff --git a/doc/groff.texi b/doc/groff.texi
index d8f5552..9925568 100644
--- a/doc/groff.texi
+++ b/doc/groff.texi
@@ -3241,11 +3241,6 @@ Sets its first argument in a @code{constant-width} 
(monospaced)
 roman typeface.  It operates similarly to the @code{B}@tie{}macro
 otherwise.  This is a Version@tie{}10 Research Unix extension.
 @c possibly V9, but definitely not Berkeley
-
-In @code{groff} @file{ms} you might prefer to change the font family to
-Courier, which is monospaced, by setting the @code{FAM} string to
-@samp{C}.  You can then use all four style macros above, returning to
-the default family (Times) with @samp{.ds FAM T}.
 @endDefmac
 
 @Defmac {BX, [@Var{txt}], ms}
@@ -3289,6 +3284,18 @@ superscript.
 Text enclosed with @code{\*<} and @code{\*>} is printed as a subscript.
 @endDefstr
 
+Rather than calling the @code{CW} macro, in @code{groff} @file{ms} you
+might prefer to change the font family to Courier---a monospaced
+typeface---by setting the @code{FAM} string to @samp{C}.  You can then
+use all four style macros above, returning to the default family (Times)
+with @samp{.ds FAM T}.  If you set @code{FAM} before the first call of a
+sectioning, paragraphing, or (non-date) document description macro, it
+also applies to headers, footers, and footnotes (as well as the body
+text).  A change to @code{FAM} takes effect at the next paragraph, so
+@code{CW} remains useful to ``inline'' a change to the font family,
+similarly to the practice of this document in noting syntactical
+elements of @file{ms} and @code{groff}.
+
 @c ---------------------------------------------------------------------
 
 @node Lists in ms, Indented regions in ms, Highlighting in ms, ms Body Text
diff --git a/doc/ms.ms b/doc/ms.ms
index d5518c3..0bbcf5f 100644
--- a/doc/ms.ms
+++ b/doc/ms.ms
@@ -1207,20 +1207,6 @@ macro otherwise.
 .
 This is a Version\~10 Research Unix extension.
 .\" possibly V9, but definitely not Berkeley
-.
-.
-.sp \n[PD]u
-In
-.I "groff ms"
-you might prefer to change the font family to Courier\[em]a monospaced
-typeface\[em]by setting
-.CW \[rs]*[FAM]
-to
-.CW C \[rq]. \[lq]
-.
-You can then use all four style macros above,
-returning to the default family (Times) with
-.CW ".ds FAM T" \[rq]. \[lq]
 T}
 _
 \&.BX [txt]    T{
@@ -1294,6 +1280,44 @@ T}
 .TE
 .
 .
+.PP
+Rather than calling the
+.CW CW
+macro,
+in
+.I "groff ms"
+you might prefer to change the font family to Courier\[em]a monospaced
+typeface\[em]by setting
+.CW \[rs]*[FAM]
+to
+.CW C \[rq]. \[lq]
+.
+You can then use all four style macros above,
+returning to the default family (Times) with
+.CW ".ds FAM T" \[rq]. \[lq]
+.
+If you set
+.CW \[rs]*[FAM]
+before the first call of a sectioning,
+paragraphing,
+or (non-date) document description macro,
+it also applies to headers,
+footers,
+and footnotes
+(as well as the body text).
+.
+A change to
+.CW \[rs]*[FAM]
+takes effect at the next paragraph,
+so
+.CW .CW
+remains useful to \[lq]inline\[rq] a change to the font family,
+as used in this document to note syntactical elements of
+.I ms
+and
+.I groff .
+.
+.
 .NH 2
 Lists
 .XS
diff --git a/tmac/groff_ms.7.man b/tmac/groff_ms.7.man
index 4ca40e0..71d9b3c 100644
--- a/tmac/groff_ms.7.man
+++ b/tmac/groff_ms.7.man
@@ -1694,10 +1694,21 @@ respectively, in
 .
 The
 .B FAM
-string sets the default font family.
+string sets the font family for body text.
 .
 If this string is undefined at initialization,
-it is set to Times.
+it is set to
+.RB \[lq] T \[rq]
+(Times).
+.
+Setting
+.B \[rs]*[FAM]
+before the first call of a sectioning,
+paragraphing,
+or (non-date) document description macro also applies it to headers,
+footers,
+and footnotes
+(as well as the body text).
 .
 .
 .LP
diff --git a/tmac/s.tmac b/tmac/s.tmac
index f00fecd..e9c1b3d 100644
--- a/tmac/s.tmac
+++ b/tmac/s.tmac
@@ -501,6 +501,7 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>.
 .af % 0
 .nr pg*page-number-in-decimal \\n%
 .af % \\*[pg*saved-page-number-format]
+.fam \\*[pg@titles-font-family]
 .ie \\n[pg*page-number-in-decimal]=1 .if \\n[pg*P1] .tl \\*[pg*OH]
 .el \{\
 .      ie o .tl \\*[pg*OH]
@@ -508,6 +509,7 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>.
 .\}
 ..
 .de BT
+.fam \\*[pg@titles-font-family]
 .ie o .tl \\*[pg*OF]
 .el .tl \\*[pg*EF]
 ..
@@ -713,6 +715,7 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>.
 .par@reset-env
 .fn*start-div
 .par@reset
+.fam \\*[fn@font-family]
 .ie \\n[.$] .FP \\$@
 .el .@LP
 ..
@@ -1156,6 +1159,8 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>.
 .if !rFPD .nr FPD \\n[PD]/2
 .ev
 .if !dFAM .ds FAM \\n[.fam]
+.ds pg@titles-font-family \\*[FAM]
+.ds fn@font-family \\*[FAM]
 .nr par*adj \\n[.j]
 .par*env-init
 .ev h
@@ -1210,7 +1215,8 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>.
 .\}
 .in (u;\\n[\\n[.ev]:li]+\\n[\\n[.ev]:pli])
 .ft 1
-.fam \\*[FAM]
+.ie '\\n[.ev]'fn' .fam \\*[fn@font-family]
+.el .fam \\*[FAM]
 .ie (\\n[\\n[.ev]:PS] >= 1000) \
 .      ps (\\n[\\n[.ev]:PS]z / 1000u)
 .el \



reply via email to

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