summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwlemb <wlemb>2004-07-27 01:29:22 +0000
committerwlemb <wlemb>2004-07-27 01:29:22 +0000
commited6e025d8ea25694c0a531983cf1d255c2c9a264 (patch)
tree400aaa44d4426fffc8c65fcc1c8eda90837aa449
parent84c727ff469a27244e73d74a7fb3f26a8fb80ff3 (diff)
downloadgroff-ed6e025d8ea25694c0a531983cf1d255c2c9a264.tar.gz
Add requests `fcolor' and `gcolor'.
* src/roff/troff/env.cpp (fill_color_change, glyph_color_change): New functions. (init_env_requests): Add `fcolor' and `gcolor'. * src/roff/troff/input.h: Export do_glyph_color and do_fill_color. * NEWS, man/groff_diff.man, man/groff.man, doc/groff.texinfo: Document new requests.
-rw-r--r--ChangeLog13
-rw-r--r--NEWS3
-rw-r--r--doc/groff.texinfo32
-rw-r--r--man/groff.man16
-rw-r--r--man/groff_diff.man20
-rw-r--r--src/roff/troff/env.cpp22
-rw-r--r--src/roff/troff/input.h3
7 files changed, 98 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index 18eacaa9..e29cbe00 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2004-07-26 Werner LEMBERG <wl@gnu.org>
+
+ Add requests `fcolor' and `gcolor'.
+
+ * src/roff/troff/env.cpp (fill_color_change, glyph_color_change):
+ New functions.
+ (init_env_requests): Add `fcolor' and `gcolor'.
+
+ * src/roff/troff/input.h: Export do_glyph_color and do_fill_color.
+
+ * NEWS, man/groff_diff.man, man/groff.man, doc/groff.texinfo:
+ Document new requests.
+
2004-07-24 Werner LEMBERG <wl@gnu.org>
Add support for fractional point sizes in ms macros. A value for
diff --git a/NEWS b/NEWS
index d659768e..2cf7a031 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,9 @@ VERSION 1.19.2
Troff
-----
+o Analogously to the .ft and \f pair, two new requests `glyphcolor' and
+ `fillcolor' (which pair with \m and \M, respectively) have been added.
+
o A new read-only, string-valued register `.sty' returns the name of the
current style.
diff --git a/doc/groff.texinfo b/doc/groff.texinfo
index 1111defb..60834b63 100644
--- a/doc/groff.texinfo
+++ b/doc/groff.texinfo
@@ -12318,18 +12318,27 @@ Note that @code{f} is the default scaling indicator for the
@endExample
@endDefreq
-@DefescList {\\m, , c, }
+@DefreqList {gcolor, [@Var{color}]}
+@DefescItem {\\m, , c, }
@DefescItem {\\m, @lparen{}, co, }
@DefescItem {\\m, @lbrack{}, color, @rbrack}
@DefregListEnd {.m}
-Set drawing color. The following example shows how to turn the next four
-words red.
+Set (glyph) drawing color. The following examples show how to turn the
+next four words red.
+
+@Example
+.gcolor red
+these are in red
+.gcolor
+and these words are in black.
+@endExample
@Example
\m[red]these are in red\m[] and these words are in black.
@endExample
-The escape @code{\m[]} returns to the previous color.
+The escape @code{\m[]} returns to the previous color, as does a call to
+@code{gcolor} without an argument.
@cindex drawing color name register (@code{.m})
@cindex name, drawing color, register (@code{.m})
@@ -12350,11 +12359,12 @@ the fly:
@endExample
@endDefesc
-@DefescList {\\M, , c, }
+@DefreqList {fcolor, [@Var{color}]}
+@DefescItem {\\M, , c, }
@DefescItem {\\M, @lparen{}, co, }
@DefescItem {\\M, @lbrack{}, color, @rbrack}
@DefregListEnd {.M}
-Set background color for filled objects drawn with the
+Set fill (background) color for filled objects drawn with the
@code{\D'@dots{}'} commands.
A red ellipse can be created with the following code:
@@ -12363,13 +12373,17 @@ A red ellipse can be created with the following code:
\M[red]\h'0.5i'\D'E 2i 1i'\M[]
@endExample
-The escape @code{\M[]} returns to the previous fill color.
+The escape @code{\M[]} returns to the previous fill color, as does a call to
+@code{fcolor} without an argument.
@cindex background color name register (@code{.M})
@cindex name, background color, register (@code{.M})
@cindex color name, background, register (@code{.M})
-The name of the current background color is available in the read-only,
-string-valued number register @samp{.M}.
+@cindex fill color name register (@code{.M})
+@cindex name, fill color, register (@code{.M})
+@cindex color name, fill, register (@code{.M})
+The name of the current fill (background) color is available in the
+read-only, string-valued number register @samp{.M}.
The fill color is associated with the current environment
(@pxref{Environments}).
diff --git a/man/groff.man b/man/groff.man
index 6bd261d8..4b7a5aad 100644
--- a/man/groff.man
+++ b/man/groff.man
@@ -2,7 +2,7 @@
.ig
groff.man
-Last update: 29 Jun 2004
+Last update: 26 Jul 2004
This file is part of groff, the GNU roff type-setting system.
@@ -1564,6 +1564,13 @@ Define fallback character
as string
.IR anything .
.
+.REQ .fcolor
+Set fill color to previous fill color.
+.
+.REQ .fcolor c
+Set fill color to
+.IR c .
+.
.REQ .fi
Fill output lines.
.
@@ -1626,6 +1633,13 @@ Translate
to
.IR font2 .
.
+.REQ .gcolor
+Set glyph color to previous glyph color.
+.
+.REQ .gcolor c
+Set glyph color to
+.IR c .
+.
.REQ .hc
Remove additional hyphenation indicator character.
.
diff --git a/man/groff_diff.man b/man/groff_diff.man
index 45f34774..9631736b 100644
--- a/man/groff_diff.man
+++ b/man/groff_diff.man
@@ -3,7 +3,7 @@
.ig
groff_diff.man
-Last update : 02 Jul 2004
+Last update : 26 Jul 2004
This file is part of groff, the GNU roff type-setting system.
It is the source of the man-page groff_diff(7).
@@ -1394,6 +1394,15 @@ is checked only if the particular glyph isn't found in the current font.
This test happens before checking special fonts.
.
.TP
+.BI .fcolor\ c
+Set the fill color to
+.IR c .
+If
+.I c
+is missing,
+switch to the previous fill color.
+.
+.TP
.BI .fschar\ f\ c\ string
Define fallback glyph
.I c
@@ -1467,6 +1476,15 @@ then font
will not be translated.
.
.TP
+.BI .gcolor\ c
+Set the glyph color to
+.IR c .
+If
+.I c
+is missing,
+switch to the previous glyph color.
+.
+.TP
.BI .hcode \ c1\ code1\ c2\ code2\|.\|.\|.\&
Set the hyphenation code of character
.I c1
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index f002a28b..0e27905f 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -1128,6 +1128,26 @@ void environment_copy()
skip_line();
}
+void fill_color_change()
+{
+ symbol s = get_name();
+ if (s.is_null())
+ curenv->set_fill_color(curenv->get_prev_fill_color());
+ else
+ do_fill_color(s);
+ skip_line();
+}
+
+void glyph_color_change()
+{
+ symbol s = get_name();
+ if (s.is_null())
+ curenv->set_glyph_color(curenv->get_prev_glyph_color());
+ else
+ do_glyph_color(s);
+ skip_line();
+}
+
static symbol P_symbol("P");
void font_change()
@@ -3206,7 +3226,9 @@ void init_env_requests()
init_request("fam", family_change);
init_request("fc", field_characters);
init_request("fi", fill);
+ init_request("fcolor", fill_color_change);
init_request("ft", font_change);
+ init_request("gcolor", glyph_color_change);
init_request("hc", hyphen_char);
init_request("hlm", hyphen_line_max_request);
init_request("hy", hyphenate_request);
diff --git a/src/roff/troff/input.h b/src/roff/troff/input.h
index e9b0104c..59f9e005 100644
--- a/src/roff/troff/input.h
+++ b/src/roff/troff/input.h
@@ -96,3 +96,6 @@ const int PUSH_COMP_MODE = 072;
const int POP_GROFFCOMP_MODE = 073;
#endif /* IS_EBCDIC_HOST */
+
+extern void do_glyph_color(symbol);
+extern void do_fill_color(symbol);