[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 103/115: [eqn]: Fix Savannah #64216.
From: |
G. Branden Robinson |
Subject: |
[groff] 103/115: [eqn]: Fix Savannah #64216. |
Date: |
Thu, 1 Jun 2023 10:46:17 -0400 (EDT) |
gbranden pushed a commit to branch branden-2022-06-01
in repository groff.
commit 53a21b9272b117ddf20d09264e8631cfb9ecb231
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Fri May 19 00:52:28 2023 -0500
[eqn]: Fix Savannah #64216.
[eqn]: Implement tunable "half_space" and "full_space" parameters. They
default to the same widths as "thin_space" and "thick_space",
respectively, but control the widths of the '^' and '~' input tokens.
* src/preproc/eqn/box.cpp: Add globals `half_space`, `full_space`.
(struct S): Recognize "half_space" and "full_space" as parameters to
the "set" primitive, and map them to the globals.
(half_space_box::output): Format the half space width.
(full_space_box::output): Format the full space width.
(full_space_box::output, thick_space_box::output): Drop workaround for
Firefox 1.5 MathML bug (November 2005). Emit "  " entity
instead of " ".
* src/preproc/eqn/eqn.1.man (Customization): Document feature.
* NEWS: Add item.
Fixes <https://savannah.gnu.org/bugs/?64216>. Thanks to Doug McIlroy
for the report and Damian McGuckin for the discussion.
---
ChangeLog | 24 ++++++++++++++++++++++++
NEWS | 6 ++++++
src/preproc/eqn/box.cpp | 14 ++++++++------
src/preproc/eqn/eqn.1.man | 18 ++++++++++++------
src/preproc/eqn/pbox.h | 9 ++++++++-
5 files changed, 58 insertions(+), 13 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 195896e03..85558621f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,27 @@
+2023-05-19 G. Branden Robinson <g.branden.robinson@gmail.com>
+
+ [eqn]: Implement tunable "half_space" and "full_space"
+ parameters. They default to the same widths as "thin_space" and
+ "thick_space", respectively, but control the widths of the '^'
+ and '~' input tokens.
+
+ * src/preproc/eqn/box.cpp: Add globals `half_space`,
+ `full_space`.
+ (struct S): Recognize "half_space" and "full_space" as
+ parameters to the "set" primitive, and map them to the globals.
+ (half_space_box::output): Format the half space width.
+ (full_space_box::output): Format the full space width.
+ (full_space_box::output, thick_space_box::output): Drop
+ workaround for Firefox 1.5 MathML bug (November 2005). Emit
+ "  " entity instead of " ".
+
+ * src/preproc/eqn/eqn.1.man (Customization): Document feature.
+
+ * NEWS: Add item.
+
+ Fixes <https://savannah.gnu.org/bugs/?64216>. Thanks to Doug
+ McIlroy for the report and Damian McGuckin for the discussion.
+
2023-05-19 G. Branden Robinson <g.branden.robinson@gmail.com>
[eqn]: Add `thick_space` and `thin_space` classes.
diff --git a/NEWS b/NEWS
index 52d47cc27..0fc6ac325 100644
--- a/NEWS
+++ b/NEWS
@@ -19,6 +19,12 @@ o The "gifont" primitive replaces "gfont" as the means of
configuring
ease acquisition of the eqn language in light of GNU eqn's
thirty-year-old extensions "gbfont" and "grfont".
+o New parameters tunable with the GNU eqn "set" primitive, "half_space"
+ and "full_space", enable a document to configure the space widths
+ produced by the eqn tokens '^' and '~', respectively. Previously,
+ their widths were determined by the "thin_space" and "thick_space"
+ parameters used to tune GNU eqn's automatic spacing computations.
+
Macro packages
--------------
diff --git a/src/preproc/eqn/box.cpp b/src/preproc/eqn/box.cpp
index d63c2800a..18f9226e5 100644
--- a/src/preproc/eqn/box.cpp
+++ b/src/preproc/eqn/box.cpp
@@ -47,8 +47,10 @@ int delimiter_shortfall = 50;
int null_delimiter_space = 12;
int script_space = 5;
int thin_space = 17;
+int half_space = 17;
int medium_space = 22;
int thick_space = 28;
+int full_space = 28;
int num1 = 70;
int num2 = 40;
@@ -94,6 +96,8 @@ struct S {
{ "thin_space", &thin_space },
{ "medium_space", &medium_space },
{ "thick_space", &thick_space },
+ { "half_space", &half_space },
+ { "full_space", &full_space },
{ "num1", &num1 },
{ "num2", &num2 },
{ "denom1", &denom1 },
@@ -597,7 +601,7 @@ half_space_box::half_space_box()
void half_space_box::output()
{
if (output_format == troff)
- printf("\\h'%dM'", thin_space);
+ printf("\\h'%dM'", half_space);
else if (output_format == mathml)
printf("<mtext> </mtext>");
}
@@ -610,10 +614,9 @@ full_space_box::full_space_box()
void full_space_box::output()
{
if (output_format == troff)
- printf("\\h'%dM'", thick_space);
+ printf("\\h'%dM'", full_space);
else if (output_format == mathml)
- //    doesn't display right under Firefox 1.5.
- printf("<mtext> </mtext>");
+ printf("<mtext>  </mtext>");
}
thick_space_box::thick_space_box()
@@ -626,8 +629,7 @@ void thick_space_box::output()
if (output_format == troff)
printf("\\h'%dM'", thick_space);
else if (output_format == mathml)
- //    doesn't display right under Firefox 1.5.
- printf("<mtext> </mtext>");
+ printf("<mtext>  </mtext>");
}
thin_space_box::thin_space_box()
diff --git a/src/preproc/eqn/eqn.1.man b/src/preproc/eqn/eqn.1.man
index c01690ab8..2821552dd 100644
--- a/src/preproc/eqn/eqn.1.man
+++ b/src/preproc/eqn/eqn.1.man
@@ -1216,11 +1216,6 @@ The width of subscripts and superscripts is increased by
this amount
This amount of space is automatically inserted after punctuation
characters.
.
-It also configures the width of the space produced by the
-.B \[ha]
-token
-.RB ( 17 ).
-.
.
.TP
.B medium_space
@@ -1234,7 +1229,18 @@ binary operators
This amount of space is automatically inserted on either side of
relations.
.
-It also configures the width of the space produced by the
+.
+.TP
+.B half_space
+configures the width of the space produced by the
+.B \[ha]
+token
+.RB ( 17 ).
+.
+.
+.TP
+.B full_space
+configures the width of the space produced by the
.B \[ti]
token
.RB ( 28 ).
diff --git a/src/preproc/eqn/pbox.h b/src/preproc/eqn/pbox.h
index b18541932..e4cd88e29 100644
--- a/src/preproc/eqn/pbox.h
+++ b/src/preproc/eqn/pbox.h
@@ -1,4 +1,3 @@
-// -*- C++ -*-
/* Copyright (C) 1989-2020 Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
@@ -30,6 +29,8 @@ extern int script_space;
extern int thin_space;
extern int medium_space;
extern int thick_space;
+extern int half_space;
+extern int full_space;
extern int num1;
extern int num2;
@@ -138,3 +139,9 @@ void set_script_size();
enum { HINT_PREV_IS_ITALIC = 01, HINT_NEXT_IS_ITALIC = 02 };
extern const char *current_roman_font;
+
+// Local Variables:
+// fill-column: 72
+// mode: C++
+// End:
+// vim: set cindent noexpandtab shiftwidth=2 textwidth=72:
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 103/115: [eqn]: Fix Savannah #64216.,
G. Branden Robinson <=