gbranden pushed a commit to branch branden-2023-07-05 in repository groff. commit 3028277a57df30203c7fc3bec4efdbff87def762 Author: G. Branden Robinson <g.branden.robin...@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 | 27 ++++++++++++++++----------- src/preproc/eqn/eqn.ypp | 3 ++- src/preproc/eqn/lex.cpp | 19 +++++++++++++++++-- 5 files changed, 65 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 15f882443..66eadd873 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +2023-04-14 G. Branden Robinson <g.branden.robin...@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.robin...@gmail.com> * src/preproc/eqn/lex.cpp (do_include, do_undef, do_gsize) diff --git a/NEWS b/NEWS index a1aabf361..8ce120d04 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 -------------- @@ -28,6 +37,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 9c3d43ce8..8270ffb70 100644 --- a/src/preproc/eqn/eqn.1.man +++ b/src/preproc/eqn/eqn.1.man @@ -604,9 +604,10 @@ are discussed in subsection \[lq]Spacing and typeface\[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. . In the following synopses, @@ -1684,15 +1685,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). @@ -1719,22 +1720,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. -. . .br .ne 4v @@ -1785,7 +1790,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]. . . 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; _______________________________________________ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit