[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 68/74: [eqn]: Implement new "gifont" primitive.
From: |
G. Branden Robinson |
Subject: |
[groff] 68/74: [eqn]: Implement new "gifont" primitive. |
Date: |
Fri, 28 Apr 2023 15:10:53 -0400 (EDT) |
gbranden pushed a commit to branch branden-2023-04-28
in repository groff.
commit 8f9504ba83feb3fd4fe3387674d35ce7b98bfbef
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Fri Apr 14 14:59:55 2023 -0500
[eqn]: Implement new "gifont" primitive.
* src/preproc/eqn/eqn.ypp: Add token "GFONT" (to supplement "GIFONT",
already renamed from "GFONT".
* src/preproc/eqn/lex.cpp (struct token_table): Map "gifont" and "gfont"
inputs to "GIFONT" and "GFONT" tokens.
(do_gfont, do_gifont): Employ parallel implementations, differing only
in diagnostic message text.
(yylex): Handle token "GFONT" by calling `do_gfont()`.
* src/preproc/eqn/eqn.1.man (New primitives, Fonts, Options, Bugs):
Document it.
* NEWS: Add item.
Fixes <https://savannah.gnu.org/bugs/?63967>. Thanks to Damian
McGuckin, Doug McIlroy, and Ralph Corderoy for support and suggestions.
---
ChangeLog | 20 ++++++++++++++++++++
NEWS | 10 ++++++++++
src/preproc/eqn/eqn.1.man | 31 ++++++++++++++++++-------------
src/preproc/eqn/eqn.ypp | 3 ++-
src/preproc/eqn/lex.cpp | 19 +++++++++++++++++--
5 files changed, 67 insertions(+), 16 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index cf2c0f117..445cd86d8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+2023-04-14 G. Branden Robinson <g.branden.robinson@gmail.com>
+
+ [eqn]: Implement new "gifont" primitive.
+
+ * src/preproc/eqn/eqn.ypp: Add token "GFONT" (to supplement
+ "GIFONT", already renamed from "GFONT".
+ * src/preproc/eqn/lex.cpp (struct token_table): Map "gifont" and
+ "gfont" inputs to "GIFONT" and "GFONT" tokens.
+ (do_gfont, do_gifont): Employ parallel implementations,
+ differing only in diagnostic message text.
+ (yylex): Handle token "GFONT" by calling `do_gfont()`.
+
+ * src/preproc/eqn/eqn.1.man (New primitives, Fonts, Options)
+ (Bugs): Document it.
+ * NEWS: Add item.
+
+ Fixes <https://savannah.gnu.org/bugs/?63967>. Thanks to Damian
+ McGuckin, Doug McIlroy, and Ralph Corderoy for support and
+ suggestions.
+
2023-04-07 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/preproc/eqn/lex.cpp (do_include, do_undef, do_gsize)
diff --git a/NEWS b/NEWS
index b2e3fc18b..00294fd01 100644
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,15 @@ not described. There are more details in the man and info
pages.
VERSION next
============
+eqn
+---
+
+o The "gifont" primitive replaces "gfont" as the means of configuring
+ the global italic face within an equation. "gfont" remains recognized
+ as a synonym for backward compatibility. The new name is intended to
+ ease acquisition of the eqn language in light of GNU eqn's
+ thirty-year-old extensions "gbfont" and "grfont".
+
Macro packages
--------------
@@ -20,6 +29,7 @@ o The s (ms) macro package now sets the vertical spacing
register
document with a type size of 20 points, the vertical spacing now
defaults to 24 points rather than 22.
+
VERSION 1.23.0
==============
diff --git a/src/preproc/eqn/eqn.1.man b/src/preproc/eqn/eqn.1.man
index ccf04380c..4bbe695e3 100644
--- a/src/preproc/eqn/eqn.1.man
+++ b/src/preproc/eqn/eqn.1.man
@@ -380,9 +380,10 @@ are discussed in subsection \[lq]Automatic spacing\[rq]
above;
.RB \[lq] set \[rq]
in subsection \[lq]Customization\[rq] below;
and
-.B grfont
+.BR gbfont ,
+.BR gifont ,
and
-.B gbfont
+.B grfont
in subsection \[lq]Fonts\[rq] below.
.
.
@@ -1415,15 +1416,15 @@ and bold.
.
Assign each a
.I groff
-typeface with the primitives
-.BR gfont ,
+typeface with the GNU extension primitives
.BR \%grfont ,
+.BR \%gifont ,
and
.B \%gbfont.
.
The defaults are the styles
-.BR I ,
.BR R ,
+.BR I ,
and
.B B
(applied to the current font family).
@@ -1448,22 +1449,26 @@ primitive to select an (upright) bold style.
.RI Select\~ f
as the bold font.
.
-This is a GNU extension.
-.
.
.TP
-.BI gfont\~ f
+.BI gifont\~ f
.RI Select\~ f
as the italic font.
.
+For
+AT&T
+.I eqn \" AT&T
+compatibility,
+.B gfont
+is recognized as a synonym for
+.BR gifont .
+.
.
.TP
.BI grfont\~ f
.RI Select\~ f
as the roman font.
.
-This is a GNU extension.
-.
.
.\" ====================================================================
.SH Options
@@ -1511,7 +1516,7 @@ statements in the source file override this option.
.TP
.BI \-f\~ F
is equivalent to
-.RB \[lq] gfont
+.RB \[lq] gifont
.IR F \[rq].
.
.
@@ -1705,7 +1710,7 @@ command
.
.RS
.EX
-gfont PI
+gifont PI
.EE
.RE
.
@@ -1716,7 +1721,7 @@ you must use
.
.RS
.EX
-gfont "PI"
+gifont "PI"
.EE
.RE
.
diff --git a/src/preproc/eqn/eqn.ypp b/src/preproc/eqn/eqn.ypp
index d6f8c8b58..4e806d8d7 100644
--- a/src/preproc/eqn/eqn.ypp
+++ b/src/preproc/eqn/eqn.ypp
@@ -86,7 +86,7 @@ void yyerror(const char *);
/* these are handled in the lexer */
%token SPACE
-%token GIFONT
+%token GFONT
%token GSIZE
%token DEFINE
%token NDEFINE
@@ -100,6 +100,7 @@ void yyerror(const char *);
%token SET
%token GRFONT
%token GBFONT
+%token GIFONT
/* The original eqn manual says that 'left' is right associative. It's lying.
Consider 'left ( ~ left ( ~ right ) right )'. */
diff --git a/src/preproc/eqn/lex.cpp b/src/preproc/eqn/lex.cpp
index 8eaaca593..d2d53f310 100644
--- a/src/preproc/eqn/lex.cpp
+++ b/src/preproc/eqn/lex.cpp
@@ -94,7 +94,8 @@ static struct {
{ "mark", MARK },
{ "lineup", LINEUP },
{ "space", SPACE },
- { "gfont", GIFONT },
+ { "gifont", GIFONT },
+ { "gfont", GFONT }, // for backward compatibility
{ "gsize", GSIZE },
{ "define", DEFINE },
{ "sdefine", SDEFINE },
@@ -1004,7 +1005,7 @@ void do_gsize()
lex_error("invalid size '%1'", token_buffer.contents());
}
-void do_gifont()
+void do_gfont()
{
int t = get_token(2);
if (t != TEXT && t != QUOTED_TEXT) {
@@ -1015,6 +1016,17 @@ void do_gifont()
set_gifont(token_buffer.contents());
}
+void do_gifont()
+{
+ int t = get_token(2);
+ if (t != TEXT && t != QUOTED_TEXT) {
+ lex_error("invalid argument to gifont primitive");
+ return;
+ }
+ token_buffer += '\0';
+ set_gifont(token_buffer.contents());
+}
+
void do_grfont()
{
int t = get_token(2);
@@ -1172,6 +1184,9 @@ int yylex()
case GSIZE:
do_gsize();
break;
+ case GFONT:
+ do_gfont();
+ break;
case GIFONT:
do_gifont();
break;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 68/74: [eqn]: Implement new "gifont" primitive.,
G. Branden Robinson <=