summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwlemb <wlemb>2002-04-11 19:38:07 +0000
committerwlemb <wlemb>2002-04-11 19:38:07 +0000
commit979cf103ad27c96c6e94aa50d3d44a2845cd4eba (patch)
tree7870626838bef90037cced11d70cf2dc4285266f
parentffaf5dbdc9733e8b6a5f2ec3ef0c1d34af9e5afc (diff)
downloadgroff-979cf103ad27c96c6e94aa50d3d44a2845cd4eba.tar.gz
* doc/groff.texinfo: More fixes.
* src/include/color.h: Decorate with `const'. Use `size_t'. Include `stddef.h'. * src/libs/libgroff.color.cc: Decorate with `const'. Use `size_t'. (color::color): Initialize members. * src/libs/libdriver/input.cc (parse_D_command): Handle `f' command according to the documentation. * man/groff_out.man: Updated. Minor fixes. * src/preproc/html/pre-html.cc (write_start_image): Remove redundant output. * tmac/www.tmac (DC, HTML-DO-IMAGE): Ditto. * src/devices/grohtml/post-html.cc (page::add_and_encode): Using \C'hy' caused an assertion failure. * src/roff/troff/env.cc (environment::environment): Initialize `emitted_node'. (environment::copy): Handle `ignore_next_eol' and `emitted_node'.
-rw-r--r--ChangeLog31
-rw-r--r--doc/groff.texinfo290
-rw-r--r--man/groff.man2
-rw-r--r--man/groff_out.man410
-rw-r--r--src/devices/grohtml/post-html.cc4
-rw-r--r--src/include/color.h55
-rw-r--r--src/libs/libdriver/input.cc17
-rw-r--r--src/libs/libgroff/color.cc91
-rw-r--r--src/preproc/html/pre-html.cc2
-rw-r--r--src/roff/troff/env.cc3
-rw-r--r--tmac/www.tmac4
11 files changed, 632 insertions, 277 deletions
diff --git a/ChangeLog b/ChangeLog
index 79522d3d..7b8d82d7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,34 @@
+2002-04-11 Werner LEMBERG <wl@gnu.org>
+
+ * doc/groff.texinfo: More fixes.
+
+2002-04-11 Bernd Warken <bwarken@mayn.de>
+
+ * src/include/color.h: Decorate with `const'.
+ Use `size_t'.
+ Include `stddef.h'.
+ * src/libs/libgroff.color.cc: Decorate with `const'.
+ Use `size_t'.
+ (color::color): Initialize members.
+ * src/libs/libdriver/input.cc (parse_D_command): Handle `f'
+ command according to the documentation.
+
+ * man/groff_out.man: Updated.
+ Minor fixes.
+
+2002-04-11 Gaius Mulley <gaius@glam.ac.uk>
+
+ * src/preproc/html/pre-html.cc (write_start_image): Remove
+ redundant output.
+ * tmac/www.tmac (DC, HTML-DO-IMAGE): Ditto.
+
+ * src/devices/grohtml/post-html.cc (page::add_and_encode): Using
+ \C'hy' caused an assertion failure.
+
+ * src/roff/troff/env.cc (environment::environment): Initialize
+ `emitted_node'.
+ (environment::copy): Handle `ignore_next_eol' and `emitted_node'.
+
2002-04-10 Werner LEMBERG <wl@gnu.org>
* man/groff_diff.man, man/groff.man, NEWS, doc/groff.texinfo:
diff --git a/doc/groff.texinfo b/doc/groff.texinfo
index bf552e27..c2f58ca9 100644
--- a/doc/groff.texinfo
+++ b/doc/groff.texinfo
@@ -4035,6 +4035,7 @@ Several new string registers are available as well.
You can change these to handle (for example) the local language.
@xref{ms Strings and Special Characters}, for details.
+
@c =====================================================================
@node me, mm, ms, Macro Packages
@@ -5329,6 +5330,10 @@ doesn't exist, @code{gtroff} creates it.
The argument to @code{\R} usually has to be enclosed in quotes.
@xref{Escapes}, for details on parameter delimiting characters.
+
+The @code{\R} escape doesn't produce an input token in @code{gtroff};
+with other words, it vanishes completely after @code{gtroff} has
+processed it.
@endDefreq
For example, the following two lines are equivalent:
@@ -5724,6 +5729,12 @@ The minor version number. For example, if the version number is@w{
@cindex revision number register (@code{.Y})
The revision number of @code{groff}.
+@item $$
+@vindex $$
+@cindex process ID of @code{gtroff} register (@code{$$})
+@cindex @code{gtroff}, process ID register (@code{$$})
+The process ID of @code{gtroff}.
+
@item .g
@vindex .g
@cindex @code{gtroff} identification register (@code{.g})
@@ -7067,6 +7078,7 @@ output device; the code for switching to nroff mode is in the file
@xref{Conditionals and Loops}, for more details on built-in
conditions.
+
@c =====================================================================
@node Line Layout, Page Layout, Troff and Nroff Mode, gtroff Reference
@@ -7526,6 +7538,15 @@ and sausage.
eggs, bacon, \fBspam\fP and sausage.
@endExample
+Note that @code{\f} doesn't produce an inpt token in @code{gtroff}.
+As a consequence, it can be used in requests like @code{mc} (which
+expects a single character as an argument) to change the font on
+the fly:
+
+@Example
+.mc \f[I]x\f[P]
+@endExample
+
@xref{Font Positions}, for an alternative syntax.
@endDefreq
@@ -8403,6 +8424,7 @@ This is a test.
@endExample
@endDefesc
+
@c =====================================================================
@node Sizes, Strings, Fonts, gtroff Reference
@@ -8504,6 +8526,15 @@ Increase or decrease the point size by @var{nn}@w{ }points. @var{nn}
must be exactly two digits.
@end table
+Note that @code{\s} doesn't produce an input token in @code{gtroff}.
+As a consequence, it can be used in requests like @code{mc} (which
+expects a single character as an argument) to change the font on
+the fly:
+
+@Example
+.mc \s[20]x\s[0]
+@endExample
+
@xref{Fractional Type Sizes}, for yet another syntactical form of
using the @code{\s} escape.
@endDefreq
@@ -8810,8 +8841,8 @@ characters.
The @code{ds1} request turns off compatibility mode
while interpreting a string. To be more precise, a @dfn{compatibility
-save} token is inserted at the beginning of the string, and a
-@dfn{compatibility restore} token at the end.
+save} input token is inserted at the beginning of the string, and a
+@dfn{compatibility restore} input token at the end.
@Example
.nr xxx 12345
@@ -8933,9 +8964,9 @@ to the string stored as @var{name} instead of redefining it. If
The @code{as1} request is similar to @code{as}, but compatibility mode
is switched off while the appended string is interpreted. To be more
-precise, a @dfn{compatibility save} token is inserted at the beginning
-of the appended string, and a @dfn{compatibility restore} token at the
-end.
+precise, a @dfn{compatibility save} input token is inserted at the
+beginning of the appended string, and a @dfn{compatibility restore}
+input token at the end.
@endDefreq
Rudimentary string manipulation routines are given with the next two
@@ -9403,8 +9434,9 @@ existing macro like this:
The @code{am1} request turns off compatibility mode
while executing the appended macro piece. To be more precise, a
-@dfn{compatibility save} token is inserted at the beginning of the
-appended code, and a @dfn{compatibility restore} token at the end.
+@dfn{compatibility save} input token is inserted at the beginning of
+the appended code, and a @dfn{compatibility restore} input token at
+the end.
The @code{ami} request appends indirectly,
meaning that @code{gtroff} expands strings whose names
@@ -10540,6 +10572,7 @@ The vertical size of lines is not preserved; glyph information (font,
font size, space width, etc.)@: is retained.
@endDefreq
+
@c =====================================================================
@node Environments, Suppressing output, Diversions, gtroff Reference
@@ -10682,6 +10715,7 @@ that @code{gtroff} shold place an accent)
of the last character added to the current environment.
@endDefreg
+
@c =====================================================================
@node Suppressing output, Colors, Environments, gtroff Reference
@@ -10816,6 +10850,7 @@ The fill color is associated with the current environment
(@pxref{Environments}).
@endDefesc
+
@c =====================================================================
@node I/O, Postprocessor Access, Colors, gtroff Reference
@@ -10900,17 +10935,35 @@ jump to the end of file.
@cindex reading from standard input (@code{rd})
@cindex standard input, reading from (@code{rd})
@cindex input, standard, reading from (@code{rd})
-@Defreq {rd, prompt}
+@Defreq {rd, [@Var{prompt} [@Var{arg1} @Var{arg2} @dots{}]]}
Read from standard input, and include what is read as though it
were part of the input file. Text is read until a blank line
is encountered.
+
+If standard input is a TTY input device (keyboard), write @var{prompt}
+to standard error, followed by a colon (or send BEL for a beep if no
+argument is given).
+
+Arguments after @var{prompt} are available for the input. For example,
+the line
+
+@Example
+.rd data foo bar
+@endExample
+
+with the input @w{@samp{This is \$2.}} prints
+
+@Example
+This is bar.
+@endExample
@endDefreq
@cindex form letters
@cindex letters, form
Using the @code{nx} and @code{rd} requests,
it is easy to set up form letters. The form
-letter template is constructed like this:
+letter template is constructed like this, putting the following lines
+into a file called @file{repeat.let}:
@Example
.ce
@@ -10928,11 +10981,11 @@ Body of letter.
@cindex @code{ex} request, used with @code{nx} and @code{rd}
@noindent
-When this is run, the following file should be redirected in. Note that
-requests included in this file are executed as though they were part of
-the form letter. The last block of input is the @code{ex} requests
-which tells groff to stop processing. If this was not there, groff
-would not know when to stop.
+When this is run, a file containing the following lines should be
+redirected in. Note that requests included in this file are executed
+as though they were part of the form letter. The last block of input
+is the @code{ex} request which tells groff to stop processing. If
+this was not there, groff would not know when to stop.
@Example
Trent A. Fisher
@@ -10951,7 +11004,7 @@ Dear Mr. Adollar,
@endExample
@Defreq {pi, pipe}
-Pipes the output of @code{gtroff} to the shell command(s)
+Pipe the output of @code{gtroff} to the shell command(s)
specified by @var{pipe}. This request must occur before
@code{gtroff} has a chance to print anything.
@@ -11000,7 +11053,7 @@ of the @code{system()} function executed by the last @code{sy} request.
@cindex file, appending to (@code{opena})
@DefreqList {open, stream file}
@DefreqListEnd {opena, stream file}
-Opens the specified @var{file} for writing and
+Open the specified @var{file} for writing and
associates the specified @var{stream} with it.
The @code{opena} request is like @code{open}, but if the file exists,
@@ -11017,7 +11070,7 @@ option to activate unsafe mode.
@cindex file, writing to (@code{write})
@DefreqList {write, stream data}
@DefreqListEnd {writec, stream data}
-Writes to the file associated with the specified @var{stream}.
+Write to the file associated with the specified @var{stream}.
The stream must previously have
been the subject of an open request. The remainder of the line is
interpreted as the @code{ds} request reads its second argument: A
@@ -11029,7 +11082,7 @@ The @code{writec} request is like @code{write}, but only
@cindex @code{asciify} and @code{writem}
@Defreq {writem, stream xx}
-Writes the contents of the macro or string @var{xx}
+Write the contents of the macro or string @var{xx}
to the file associated with the specified @var{stream}.
@var{xx} is read in copy mode, i.e., already formatted elements are
@@ -11041,7 +11094,7 @@ means a loss of information.
@cindex closing file (@code{close})
@cindex file, closing (@code{close})
@Defreq {close, stream}
-Closes the specified @var{stream};
+Close the specified @var{stream};
the stream is no longer an acceptable argument to the
@code{write} request.
@@ -11054,12 +11107,13 @@ the stream is no longer an acceptable argument to the
@end ignore
@endDefreq
-@Defesc {\\V, ', xxx, '}
-Interpolates the contents of the specified
-environment variable, as returned by the function @code{getenv}.
-Specify the argument to @code{\V} as an identifier, i.e.@:
-@samp{\V@var{x}}, @samp{\V(@var{xx}} or @samp{\V[@var{xxx}]}. @code{\V}
-is interpreted in copy-in mode.
+@DefescList {\\V, , e, }
+@DefescItem {\\V, @lparen{}, ev, }
+@DefescListEnd {\\V, @lbrack{}, env, @rbrack}
+Interpolate the contents of the specified environment variable
+@var{env} (one-character name@w{ }@var{e}, two-character name @var{ev})
+as returned by the function @code{getenv}. @code{\V} is interpreted
+in copy-in mode.
@endDefesc
@@ -11102,16 +11156,18 @@ Additionally, the backslash is represented as @code{\\}.
This mechanism is currently used by @code{grohtml} only.
@endDefesc
-@Defesc {\\Y, ', xxx, '}
-The @code{\Y} escape is called with an identifier (i.e.@:
-@code{\Y@var{x}}, @code{\Y(@var{xx}} or @code{\Y[@var{xxx}]}). This is
-approximately equivalent to @samp{\X'\*[@var{xxx}]'}. However, the
-contents of the string or macro @var{xxx} are not interpreted; also it
-is permitted for @var{xxx} to have been defined as a macro and thus
-contain newlines (it is not permitted for the argument to @code{\X} to
-contain newlines). The inclusion of newlines requires an extension to
-the @acronym{UNIX} @code{troff} output format, and confuses drivers
-that do not know about this extension.
+@DefescList {\\Y, , n, }
+@DefescItem {\\Y, @lparen{}, nm, }
+@DefescListEnd {\\Y, @lbrack{}, name, @rbrack}
+This is approximately equivalent to @samp{\X'\*[@var{name}]'}
+(one-character name@w{ }@var{n}, two-character name @var{nm}).
+However, the contents of the string or macro @var{name} are not
+interpreted; also it is permitted for @var{name} to have been defined
+as a macro and thus contain newlines (it is not permitted for the
+argument to @code{\X} to contain newlines). The inclusion of
+newlines requires an extension to the @acronym{UNIX} @code{troff}
+output format, and confuses drivers that do not know about this
+extension (@pxref{Line Continuation}).
@endDefesc
@xref{Output Devices}.
@@ -11129,36 +11185,76 @@ categorized elsewhere in this manual.
@cindex printing line numbers (@code{nm})
@cindex line numbers, printing (@code{nm})
@cindex numbers, line, printing (@code{nm})
-@Defreq {nm, start inc space indent}
-Prints line numbers in the left margin.
+@Defreq {nm, [@Var{start} [@Var{inc} [@Var{space} [@Var{indent}]]]]}
+Print line numbers.
@var{start} is the line number of the @emph{next}
-output line; this defaults to@w{ }1. @var{inc} indicates on
-which lines numbers are printed, i.e.@: 5 means put line numbers on
-every 5@w{ }lines; this defaults to@w{ }1. @var{space} is the
-space to be left between the number and the text; this defaults to@w{
-}1. The fourth argument is the indentation of the line numbers.
-Without arguments, line numbers are turned off.
+output line. @var{inc} indicates which line numbers are printed.
+For example, the value@w{ }5 means to emit only line numbers which
+are multiples of@w{ }5; this defaults to@w{ }1. @var{space} is the
+space to be left between the number and the text; this defaults to
+one digit space. The fourth argument is the indentation of the line
+numbers, defaulting to zero. Both @var{space} and @var{indent} are
+given as multiples of digit spaces; they can be negative also.
+Without any arguments, line numbers are turned off.
+
+@code{gtroff} reserves three digit spaces for the line number (which is
+printed right-justified) plus the amount given by @var{indent}; the
+output lines are concatenated to the line numbers, separated by
+@var{space}, and @emph{without} reducing the line length. Depending
+on the value of the horizontal page offset (as set with the
+@code{po} request), line numbers which are longer than the reserved
+space stick out to the left, or the whole line is moved to the right.
+
+Parameters corresponding to missing arguments are not changed; any
+non-digit argument (to be more precise, any argument starting with a
+character valid as a delimiter for identifiers) is also treated as
+missing.
+
+If line numbering has been disabled with a call to @code{nm} without
+an argument, it can be reactivated with @samp{.nm +0}, using the
+previously active line numbering parameters.
The parameters of @code{nm} are associated with the current environment
(@pxref{Environments}).
-@endDefreq
-
-@c XXX xref ln register
-
-@Defreq {nn, [@Var{skip}]}
-Temporarily turns off line numbering. The
-argument is the number of lines not to be numbered; this defaults
-to@w{ }1.
-@c XXX (does this disable incrementing or display?)
+@Example
+.po 1m
+.ll 2i
+This test shows how line numbering works with groff.
+.nm 999
+This test shows how line numbering works with groff.
+.br
+.nm xxx 3 2
+.ll -\w'0'u
+This test shows how line numbering works with groff.
+.nn 2
+This test shows how line numbering works with groff.
+@endExample
-@c XXX example
+@noindent
+And here the result:
-@ignore
@Example
-... line numbering example ...
+ This test shows how
+ line numbering works
+ 999 with groff. This
+1000 test shows how line
+1001 numbering works with
+1002 groff.
+ This test shows how
+ line numbering
+ works with groff.
+ This test shows how
+1005 line numbering
+ works with groff.
@endExample
-@end ignore
+@endDefreq
+
+@c XXX xref ln register
+
+@Defreq {nn, [@Var{skip}]}
+Temporarily turns off line numbering. The argument is the number
+of lines not to be numbered; this defaults to@w{ }1.
@endDefreq
@cindex margin characters (@code{mc})
@@ -11189,29 +11285,6 @@ there are programs available for doing this (they are called
@end ignore
@endDefreq
-@pindex soelim
-@cindex multi-file documents
-@cindex documents, multi-file
-@cindex setting input line number (@code{lf})
-@cindex input line number, setting (@code{lf})
-@cindex number, input line, setting (@code{lf})
-@Defreq {lf, line filename}
-A debugging aid for
-documents which are split into many files, then put together
-with @code{soelim} and other preprocessors. The second argument is the
-name of the file and the first argument is the input line number in
-that file. This way @code{gtroff} can produce error messages which are
-intelligible to the user.
-
-@c XXX example
-
-@ignore
-@Example
-... example of soelim'ed doc ...
-@endExample
-@end ignore
-@endDefreq
-
@cindex PostScript, bounding box
@cindex bounding box
@DefreqList {psbb, filename}
@@ -11226,11 +11299,12 @@ Adobe's @dfn{Document Structuring Conventions} (DSC);
the command searches for a @code{%%BoundingBox} comment
and extracts the bounding box values into the number registers
@code{llx}, @code{lly}, @code{urx}, and @code{ury}.
-If an error occurs (e.g. @code{psbb} cannot find
+If an error occurs (for example, @code{psbb} cannot find
the @code{%%BoundingBox} comment),
it sets the four number registers to zero.
@endDefreq
+
@c =====================================================================
@node Gtroff Internals, Debugging, Miscellaneous, gtroff Reference
@@ -11241,20 +11315,29 @@ it sets the four number registers to zero.
@cindex output node
@cindex node, output
@code{gtroff} processes input in three steps. One or more input
-characters are converted to an @dfn{input token}. Then, one or more
-input tokens are converted to an @dfn{output node}. Finally, output
-nodes are converted to the intermediate output language understood by
-all output devices.
-
-For example, the input string @samp{fi\[:u]} is converted in a
+characters are converted to an @dfn{input token}.@footnote{Except the
+escapes @code{\f}, @code{\H}, @code{\R}, @code{\s}, and @code{\S}
+which are processed immediately if not in copy-in mode.} Then, one
+or more input tokens are converted to an @dfn{output node}. Finally,
+output nodes are converted to the intermediate output language
+understood by all output devices.
+
+Actually, before step one happens, @code{gtroff} converts certain
+escape sequences into reserved input characters (not accessible by
+the user); such reserved characters are used for other internal
+processing also -- this is the very reason why not all characters
+are valid input. @xref{Identifiers}, for more on this topic.
+
+For example, the input string @samp{fi\[:u]} is converted into a
character token @samp{f}, a character token @samp{i}, and a special
token @samp{:u} (representing u@w{ }umlaut). Later on, the character
tokens @samp{f} and @samp{i} are merged to a single output node
-representing the ligature glyph @samp{fi}; the same happens with
-@samp{:u}. All output glyph nodes are `processed' which means that
-they are invariably associated with a given font, font size, advance
-width, etc. During the formatting process, @code{gtroff} itself adds
-various nodes to control the data flow.
+representing the ligature glyph @samp{fi} (provided the current font
+has a glyph for this ligature); the same happens with @samp{:u}. All
+output glyph nodes are `processed' which means that they are invariably
+associated with a given font, font size, advance width, etc. During
+the formatting process, @code{gtroff} itself adds various nodes to
+control the data flow.
Macros, diversions, and strings collect elements in two chained lists:
a list of input tokens which have been passed unprocessed, and a list
@@ -11290,7 +11373,7 @@ It contains these elements.
@noindent
Elements 1, 7, and@w{ }8 are inserted by @code{gtroff}; the latter two
(which are always present) specify the vertical extent of the last
-line, possibly modified by @code{\v}. The @code{br} request finishes
+line, possibly modified by @code{\x}. The @code{br} request finishes
the current partial line, inserting a newline input token which is
subsequently converted to a space when the diversion is reread. Note
that the word space node has a fixed width which isn't stretchable
@@ -11310,6 +11393,28 @@ empty); diversions and strings can contain elements in both lists.
@code{gtroff} is not easy to debug, but there are some useful features
and strategies for debugging.
+@pindex soelim
+@cindex multi-file documents
+@cindex documents, multi-file
+@cindex setting input line number (@code{lf})
+@cindex input line number, setting (@code{lf})
+@cindex number, input line, setting (@code{lf})
+@Defreq {lf, line filename}
+A debugging aid for documents which are split into many files,
+then put together with @code{soelim} and other preprocessors.
+The second argument is the name of the file and the first argument
+is the input line number in that file. This way @code{gtroff} can
+produce error messages which are intelligible to the user.
+
+@c XXX example
+
+@ignore
+@Example
+... example of soelim'ed doc ...
+@endExample
+@end ignore
+@endDefreq
+
@cindex printing to stderr (@code{tm})
@cindex stderr, printing to (@code{tm})
@DefreqList {tm, string}
@@ -12005,6 +12110,7 @@ is available as an extra package from the following address:
@c no longer in use). You need a pager program like @code{less} which
@c translates this into ISO 6429 SGR sequences to control terminals.
+
@c =====================================================================
@node grops, grodvi, grotty, Output Devices
diff --git a/man/groff.man b/man/groff.man
index 8c6be6b5..8fd71ef4 100644
--- a/man/groff.man
+++ b/man/groff.man
@@ -1771,7 +1771,7 @@ No hyphenation.
.REQ .nm
Number mode off.
.
-.REQ .nm \[+-]N M S I
+.REQ .nm \[+-]N \fR[\fPM \fR[\fPS \fR[\fPI\fR]]]\fP
In line number mode, set number, multiple, spacing, and indent.
.
.REQ .nn
diff --git a/man/groff_out.man b/man/groff_out.man
index d7840278..6dba4913 100644
--- a/man/groff_out.man
+++ b/man/groff_out.man
@@ -3,7 +3,7 @@
.ig
groff_out.5
-Last update: 31 Jan 2002
+Last update: 10 Apr 2002
This file is part of groff, the GNU roff type-setting system.
@@ -50,7 +50,7 @@ delim $$
.
.ig
Unfortunately, old versions of groff used an illogical position change
-after some D-commands (Dp, DP, Dt). If the number register
+after some D\~commands (Dp, DP, Dt). If the number register
@STUPID_DRAWING_POSITIONING is 1 (actual default) then change position
after these commands, otherwise the position is not changed.
..
@@ -80,7 +80,7 @@ after these commands, otherwise the position is not changed.
..
.de ShellCommand
. br
-. IR "shell#" "\h'1m'\f[CB]\$*\f[P]\/"
+. IR "shell>" "\h'1m'\f[CB]\$*\f[P]\/"
..
.ec
.\" End of macro definitions
@@ -204,7 +204,7 @@ after these commands, otherwise the position is not changed.
. IP "\f[B]Da\f[P]\ \*[@args]\|\*[@linebreak]"
. rm @args
..
-.c graphical command .D with a variable number of arguments
+.c graphics command .D with a variable number of arguments
.c format: .D-multiarg <subcommand>
.de D-multiarg
. ds @sub \$1\"
@@ -231,7 +231,8 @@ after these commands, otherwise the position is not changed.
. rm @args
..
.de xsub
-. RI \[lq] "x\ \$1" \[rq]:
+. RI "(" "\$1" " control command)"
+. br
..
.ec
.\" End of macro definitions
@@ -423,7 +424,7 @@ commands must have all of their arguments on the same line as the
command, i.e.\& the arguments may not be splitted by a line break.
.
.P
-Empty lines, i.e.\& lines containing only space and/or a comment can
+Empty lines, i.e.\& lines containing only space and/or a comment, can
occur everywhere.
.
They are just ignored.
@@ -490,7 +491,7 @@ commands.
.
The
.I groff prologue
-is guaranteed to consist of the following three lines:
+is guaranteed to consist of the following three lines (in that order):
.RS
.P
.B x\ T
@@ -555,8 +556,10 @@ extensions.
.
.TP
.BI # anything \[la]end_of_line\[ra]
-comment, ignore any characters from the
-.B #
+A comment.
+.
+Ignore any characters from the
+.BR # \~\c
character up to the next newline character.
.
.P
@@ -585,7 +588,7 @@ Optionally,
can be inserted before, after, and between the command letter and its
arguments.
.
-All of these commands are stackable, i.e.\& they can be preceded by
+All of these commands are stackable, i.e., they can be preceded by
other simple commands or followed by arbitrary other commands on the
same line.
.
@@ -593,6 +596,7 @@ A separating syntactical space is only necessary when two integer
arguments would clash or if the preceding argument ends with a string
argument.
.
+.
.if (\n[@USE_ENV_STACK] == 1) \{\
.command {
Open a new environment by copying the actual device configuration data
@@ -601,13 +605,15 @@ to the environment stack.
The current environment is setup by the device specification and
manipulated by the setting commands.
.
+.
.command }
Close the actual environment (opened by a preceding
.BR { \~command)
and restore the previous environment from the environment
stack as the actual device configuration data.
.
-\} \" endif @USE_ENV_STACK
+\} \" endif @USE_ENV_STACK
+.
.
.command C xxx \[la]white_space\[ra]
Print a special groff character named
@@ -621,6 +627,7 @@ the character's size is read from the font file.
.
The print position is not changed.
.
+.
.command c c
Print character\~\c
.argument c
@@ -629,11 +636,13 @@ the character's size is read from the font file.
.
The print position is not changed.
.
+.
.command f n
Set font to font number\~\c
.argument n
(a non-negative integer).
.
+.
.command H n
Move right to the absolute vertical position\~\c
.argument n
@@ -641,6 +650,7 @@ Move right to the absolute vertical position\~\c
.unit u )
relative to left edge of current page.
.
+.
.command h n
Move
.argument n
@@ -655,37 +665,56 @@ also, but
.I groff
doesn't use this.
.
+.
+.command m "color_scheme \f[R][\f[P]component .\|.\|.\f[R]]\f[P]"
+Set the color for text (glyphs), line drawing, and the outline of
+graphic objects using different color schemes; the analoguous command
+for the filling color of graphic objects is
+.BR DF .
+.
+The color components are specified as integer arguments between 0 and
+\n[@maxcolor] with black having all components\~0.
+.
+The number of color components and their meaning vary for the
+different color schemes.
+.
+These commands are generated by the groff escape sequence
+.BR \*[@backslash]m .
+.
+No position changing.
+.
+These commands are a groff extension.
+.
+.
+.RS
+.
.command mc "cyan magenta yellow"
-Set color for glyphs and line drawing using the CMY color scheme,
-where all arguments are integers between 0 and \n[@maxcolor] with black
-having all arguments\~0.
+Set color using the CMY color scheme, having the 3\~color components
+cyan, magenta, and yellow.
.
-This command is a groff extension.
.
.command md
-Set color for glyphs and line drawing to the default drawing color value
+Set color to the default color value
(black in most cases).
.
-This command is a groff extension.
+No component arguments.
+.
.
.command mg "gray"
-Set color for glyphs and line drawing to the shade of gray given by
-the argument, an integer between\~0 (black) and \n[@maxcolor] (white).
+Set color to the shade of gray given by the argument, an integer
+between 0 (black) and \n[@maxcolor] (white).
.
-This command is a groff extension.
.
.command mk "cyan magenta yellow black"
-Set color for glyphs and line drawing using the CMYK color scheme,
-where all arguments are integers between\~0 and \n[@maxcolor].
-.
-This command is a groff extension.
+Set color using the CMYK color scheme, having the 4\~color components
+cyan, magenta, yellow, and black.
.
.command mr "red green blue"
-Set color for glyphs and line drawing using the RGB color scheme,
-where all arguments are integers between\~0 and \n[@maxcolor] with black
-having all arguments\~0.
+Set color using the RGB color scheme, having the 3\~color components
+red, green, and blue.
+.
+.RE
.
-This command is a groff extension.
.
.command N n
Print character with index\~\c
@@ -694,6 +723,7 @@ Print character with index\~\c
.
This command is a groff extension.
.
+.
.command n b\ a
Inform the device about a line break, but no positioning is done by
this command.
@@ -709,6 +739,7 @@ any action.
In groff, they are just ignored, but they must be provided for
compatibility reasons.
.
+.
.command p n
Begin a new page in the outprint.
.
@@ -725,6 +756,7 @@ page, so a
.BR p \~command
must be issued before any of these commands.
.
+.
.command s n
Set point size to
.argument n
@@ -741,6 +773,7 @@ Classical troff used the unit
instead; see section
.BR COMPATIBILITY .
.
+.
.command t xxx \[la]white_space\[ra]
.command+ t "xxx dummy_arg" \[la]white_space\[ra]
Print a word, i.e.\& a sequence of characters
@@ -750,8 +783,8 @@ integer argument is ignored (this allows the formatter to generate
an even number of arguments).
.
The first character should be printed at the current position, the
-current horizontal position should be increased by the width of the
-first character, and so on for each character.
+current horizontal position should then be increased by the width of
+the first character, and so on for each character.
.
The widths of the characters are read from the font file, scaled for the
current point size, and rounded to a multiple of the horizontal
@@ -765,9 +798,10 @@ This command is a groff extension; it is only used for devices whose
.I DESC
file contains the
.B tcommand
-line; see
+keyword; see
.BR groff_font (@MAN5EXT@).
.
+.
.command u "n xxx" \[la]white_space\[ra]
Print word with track kerning.
.
@@ -784,9 +818,10 @@ This command is a groff extension; it is only used for devices whose
.I DESC
file contains the
.B tcommand
-line; see
+keyword; see
.BR groff_font (@MAN5EXT@).
.
+.
.command V n
Move down to the absolute vertical position\~\c
.argument n
@@ -794,6 +829,7 @@ Move down to the absolute vertical position\~\c
.unit u )
relative to upper edge of current page.
.
+.
.command v n
Move
.argument n
@@ -810,6 +846,7 @@ also, but
.I groff
doesn't use this.
.
+.
.command w
Informs about a paddable white space to increase readability.
.
@@ -820,7 +857,7 @@ The spacing itself must be performed explicitly by a move command.
.SS "Graphics Commands"
.\" --------------------------------------------------------------------
.
-Each graphical or drawing command in the intermediate output starts
+Each graphics or drawing command in the intermediate output starts
with the letter\~\c
.B D
followed by another single character that specifies a subcommand; this
@@ -844,7 +881,7 @@ letters and makes the space before the first argument optional.
As usual, each space can be any sequence of tab and space characters.
.
.P
-Some graphical commands can take a variable number of arguments.
+Some graphics commands can take a variable number of arguments.
.
In this case, they are integers representing a size measured in basic
units\~\c
@@ -870,19 +907,20 @@ escape sequence; see
.BR groff (@MAN7EXT@).
.
.P
-Unknown D-commands are assumed to be device-specific.
+Unknown D\~commands are assumed to be device-specific.
.
Its arguments are parsed as strings; the whole information is then
sent to the postprocessor.
.
.P
-In the following command references, the syntax element
+In the following command reference, the syntax element
.I \[la]line_break\[ra]
means a
.I syntactical line break
as defined in section
.BR Separation .
.
+.
.D-multiarg ~
Draw B-spline from current position to offset
.indexed_offset h 1 v 1 ,
@@ -893,6 +931,7 @@ if given, etc.\& up to
This command takes a variable number of argument pairs;
the current position is moved to the terminal point of the drawn curve.
.
+.
.Da-command
Draw arc from current position to
.indexed_offset h 1 v 1 \|+\|\c
@@ -901,6 +940,7 @@ with center at
.indexed_offset h 1 v 1 ;
then move the current position to the final point of the arc.
.
+.
.D-command C d
.D-command+ C d dummy_arg
Draw a solid circle using the current fill color with diameter\~\c
@@ -915,6 +955,7 @@ formatter to generate an even number of arguments).
.
This command is a groff extension.
.
+.
.D-command c d
Draw circle line with diameter\~\c
.argument d
@@ -923,6 +964,7 @@ Draw circle line with diameter\~\c
with leftmost point at the current position; then move the current
position to the rightmost point of the circle.
.
+.
.D-command E "h v"
Draw a solid ellipse in the current fill color with a horizontal
diameter of\~\c
@@ -936,6 +978,7 @@ rightmost point of the ellipse.
.
This command is a groff extension.
.
+.
.D-command e "h v"
Draw an outlined ellipse with a horizontal diameter of\~\c
.argument h
@@ -946,66 +989,102 @@ and a vertical diameter of\~\c
with the leftmost point at current position; then move to the
rightmost point of the ellipse.
.
-.D-command Fc "cyan magenta yellow"
-Set fill color for solid drawing objects using the CMY color scheme,
-where all arguments are integers between 0 and \n[@maxcolor] with black
-having all arguments\~0.
+.
+.D-command F "color_scheme \f[R][\f[P]component .\|.\|.\f[R]]\f[P]"
+Set fill color for solid drawing objects using different color
+schemes; the analoguous command for setting the color of text, line
+graphics, and the outline of graphic objects is
+.BR m .
+.
+The color components are specified as integer arguments between 0 and
+\n[@maxcolor] with black having all components\~0.
+.
+The number of color components and their meaning vary for the
+different color schemes.
+.
+These commands are generated by the groff escape sequences
+.B \*[@backslash]DF
+and
+.B \*[@backslash]M
+(with no other corresponding graphics command).
.
No position changing.
.
This command is a groff extension.
.
+.
+.RS
+.
+.D-command Fc "cyan magenta yellow"
+Set fill color for solid drawing objects using the CMY color scheme,
+having the 3\~color components cyan, magenta, and yellow.
+.
+.
.D-command Fd
Set fill color for solid drawing objects to the default fill color value
(black in most cases).
.
-No position changing.
+No component arguments.
.
-This command is a groff extension.
.
.D-command Fg "gray"
Set fill color for solid drawing objects to the shade of gray given by
the argument, an integer between 0 (black) and \n[@maxcolor] (white).
.
-No position changing.
-.
-This command is a groff extension.
.
.D-command Fk "cyan magenta yellow black"
Set fill color for solid drawing objects using the CMYK color scheme,
-where all arguments are integers between 0 and \n[@maxcolor].
-.
-No position changing.
-.
-This command is a groff extension.
+having the 4\~color components cyan, magenta, yellow, and black.
.
.D-command Fr "red green blue"
Set fill color for solid drawing objects using the RGB color scheme,
-where all arguments are integers between 0 and \n[@maxcolor] with black
-having all arguments\~0.
+having the 3\~color components red, green, and blue.
.
-No position changing.
+.RE
.
-This command is a groff extension.
.
.D-command f n
-Obsolete color command; sets the shade of gray for filling solid
-drawing objects to integer\~\c
-.argument n ,
+The argument
+.argument n
+must be an integer in the range -32767 to 32767.
+.
+.RS
+.TP
+.RI "0 \[<=] " n " \[<=] 1000"
+Set the color for filling solid drawing objects to a shade of gray,
where 0 corresponds to solid white, 1000 (the default) to solid black,
-and values in between to intermediate shades of gray.
+and values in between to intermediate shades of gray; this is
+obsoleted by command
+.BR DFg .
+.
+.TP
+.IR n " < 0 or " n " > 1000"
+Set the filling color to the color that is currently being used for
+the text and the outline, see command
+.BR m .
+For example, the command sequence
.
-Values outside of this range selects the shade of gray that is currently
-being used for lines and text (normally black).
+.nf
+.ft CB
+.RS
+.RS
+mg 0 0 \n[@maxcolor]
+Df -1
+.RE
+.ft
+.fi
.
-This is internally mapped to the
-.B DFg
-command.
+sets all colors to blue.
+.RE
.
+.P
No position changing.
.
This command is a groff extension.
.
+.RE
+.
+.
.D-command l "h v"
Draw line from current position to offset
.offset h v
@@ -1013,6 +1092,7 @@ Draw line from current position to offset
.unit u );
then set current position to the end of the drawn line.
.
+.
.D-multiarg p
Draw a polygon line from current position to offset
.offset h1 v1 ,
@@ -1037,6 +1117,7 @@ the position doesn't change.
.
This command is a groff extension.
.
+.
.D-multiarg P
The same macro as the corresponding
.B Dp
@@ -1052,6 +1133,7 @@ No position changing.
.
This command is a groff extension.
.
+.
.D-command t n
Set the current line thickness to\~\c
.argument n
@@ -1131,10 +1213,10 @@ means a
as defined in section
.BR Separation .
.
-.x-command F filename
+.x-command F name
.xsub Filename
Use
-.argument filename
+.argument name
as the intended name for the current file in error reports.
.
This is useful for remembering the original file name when groff uses
@@ -1144,16 +1226,18 @@ The input file is not changed by this command.
.
This command is a groff extension.
.
+.
.x-command f "n\ s"
.xsub font
Mount font position\~\c
.argument n
(a non-negative integer) with font named\~\c
.argument s
-(a word),
+(a text word),
cf.
.BR groff_font (@MAN5EXT@).
.
+.
.x-command H n
.xsub Height
Set character height to\~\c
@@ -1167,12 +1251,14 @@ points (\c
instead; see section
.BR COMPATIBILITY .
.
+.
.x-command i
.xsub init
Initialize device.
.
This is the third command of the prologue.
.
+.
.x-command p
.xsub pause
Parsed but ignored.
@@ -1181,6 +1267,7 @@ The classical documentation reads
.I pause device, can be
.IR restarted .
.
+.
.x-command r "n\ h\ v"
.xsub resolution
Resolution is\~\c
@@ -1196,6 +1283,7 @@ per inch.
.
This is the second command of the prologue.
.
+.
.x-command S n
.xsub Slant
Set slant to\~\c
@@ -1203,11 +1291,13 @@ Set slant to\~\c
(an integer in basic units\~\c
.unit u ).
.
+.
.x-command s
.xsub stop
Terminates the processing of the current file; issued as the last
command of any intermediate troff output.
.
+.
.x-command t
.xsub trailer
Generate trailer information, if any.
@@ -1216,14 +1306,20 @@ In
.IR groff ,
this is actually just ignored.
.
+.
.x-command T xxx
.xsub Typesetter
Set name of device to word
.argument xxx ,
a sequence of characters ended by the next white space character.
.
+The possible device names coincide with those from the groff
+.B -T
+option.
+.
This is the first command of the prologue.
.
+.
.x-command u n
.xsub underline
Configure underlining of spaces.
@@ -1243,6 +1339,7 @@ mode and is ignored otherwise.
.
This command is a groff extension.
.
+.
.x-command X anything
.xsub X-escape
Send string
@@ -1269,7 +1366,7 @@ This command is generated by the
escape sequence
.BR \*[@backslash]X .
.
-The line continuing feature is a groff extension.
+The line-continuing feature is a groff extension.
.
.
.\" --------------------------------------------------------------------
@@ -1284,6 +1381,7 @@ character.
.
It didn't have a command code, but is represented by a 3-character
argument consisting of exactly 2 digits and a character.
+.
.TP
.argument ddc
Move right
@@ -1293,7 +1391,8 @@ Move right
then print character\~\c
.argument c .
.
-.IP
+.RS
+.P
In groff, arbitrary syntactical space around and within this command
is allowed to be added.
.
@@ -1306,7 +1405,9 @@ In
large cluster of these and other commands were used, mostly without
spaces; this made such output almost unreadable.
.
-.IP
+.RE
+.
+.P
For modern high-resolution devices, this command does not make sense
because the width of the characters can become much larger than two
decimal digits.
@@ -1316,7 +1417,7 @@ In groff, this is only used for the devices
.BR X75-12 ,
.BR X100 ,
and
-.B X100-12 .
+.BR X100-12 .
.
For other devices,
the commands
@@ -1327,6 +1428,35 @@ provide a better functionality.
.
.
.\" --------------------------------------------------------------------
+.SH "POSTPROCESSING"
+.\" --------------------------------------------------------------------
+.
+The
+.I roff
+postprocessors are programs that have the task to translate the
+intermediate output into actions that are sent to a device.
+.
+A device can be some piece of hardware such as a printer, or a software
+file format suitable for graphical or text processing.
+.
+The
+.I groff
+system provides powerful means that make the programming of such
+postprocessors an easy task.
+.P
+There is a library function that parses the intermediate output and
+sends the information obtained to the device via methods of a class
+with a common interface for each device.
+.
+So a
+.I groff
+postprocessor must only redefine the methods of this class.
+.
+For details, see the reference in section
+.BR FILES .
+.
+.
+.\" --------------------------------------------------------------------
.SH "EXAMPLES"
.\" --------------------------------------------------------------------
.
@@ -1334,7 +1464,7 @@ This section presents the intermediate output generated from the same
input for three different devices.
.
The input is the sentence
-.I `hell world'
+.I hell world
fed into groff on the command line.
.
.Topic
@@ -1342,6 +1472,7 @@ High-resolution device
.I ps
.
.RS
+.
.P
.ShellCommand echo "hell world" | groff -Z -T ps
.
@@ -1370,30 +1501,63 @@ x stop
.fi
.RE
.
+.P
+This output can be fed into the postprocessor
+.BR grops (@MAN1EXT@)
+to get its representation as a PostScript file.
+.
+.
.Topic
Low-resolution device
.I latin1
.
.RS
+.
+.P
+This is similar to the high-resolution device except that the
+positioning is done at a minor scale.
+.
+Some comments (lines starting with
+.IR # )
+were added for clarification; they were not generated by the
+formatter.
+.
.P
.ShellCommand echo "hell world" | groff -Z -T latin1
.
.P
.nf
+.I # prologue
.ft CB
x T latin1
x res 240 24 40
x init
+.I # begin a new page
+.ft CB
p1
+.I # font setup
+.ft CB
x font 1 R
f1
s10
+.I # initial positioning on the page
+.ft CB
V40
H0
+.I # write text `hell'
+.ft CB
thell
+.I # inform about a space, and do it by a horizontal jump
+.ft CB
wh24
+.I # write text `world'
+.ft CB
tworld
+.I # announce line break, but do nothing because ...
+.ft CB
n40 0
+.I # ... the end of the document has been reached
+.ft CB
x trailer
V2640
x stop
@@ -1401,10 +1565,22 @@ x stop
.fi
.RE
.
+.P
+This output can be fed into the postprocessor
+.BR grotty (@MAN1EXT@)
+to get a formatted text document.
+.
+.
.Topic
-Classical style output for the X devices
+Classical style output
.
.RS
+.
+.P
+As a computer monitor has a very low resolution compared to modern
+printers the intermediate output for the X\~devices can use the
+jump-and-write command with its 2-digit displacements.
+.
.P
.ShellCommand echo "hell world" | groff -Z -T X100
.
@@ -1420,6 +1596,8 @@ f5
s10
V16
H100
+.I # write text with old-style jump-and-write command
+.ft CB
ch07e07l03lw06w11o07r05l03dh7
n16 0
x trailer
@@ -1430,37 +1608,15 @@ x stop
.RE
.
.P
-The text clusters of the classical output are much harder to be read,
-due to the obsolete jump'n'write command.
-.
-.
-.\" --------------------------------------------------------------------
-.SH "POSTPROCESSING"
-.\" --------------------------------------------------------------------
-.
-The
-.I roff
-postprocessors are programs that have the task to translate the
-intermediate output into actions that are sent to a device.
-.
-A device can be some piece of hardware such as a printer, or a software
-file format suitable for graphical or text processing.
+This output can be fed into the postprocessor
+.BR xditview (1x)
+or
+.BR gxditview (@MAN1EXT@)
+for displaying in X window.
.
-The
-.I groff
-system provides powerful means that make the programming of such
-postprocessors an easy task.
.P
-There is a library function that parses the intermediate output and
-sends the information obtained to the device via methods of a class
-with a common interface for each device.
-.
-So a
-.I groff
-postprocessor must only redefine the methods of this class.
-.
-For details, see the reference in section
-.BR FILES .
+Due to the obsolete jump-and-write command, the text clusters in the
+classical output are almost unreadable.
.
.
.\" --------------------------------------------------------------------
@@ -1512,11 +1668,10 @@ has the implicit unit scaled point\~\c
in groff, while classical troff had point (\c
.unit p ).
.
-This isn't an incompatibility, but a compatible extension.
-.
-For, both units coincide for all devices without a
+This isn't an incompatibility, but a compatible extension,
+for both units coincide for all devices without a
.I sizescale
-parameter, this includes all classical and the groff text devices.
+parameter, including all classical and the groff text devices.
.
The few groff devices with a sizescale parameter either did
not exist, had a different name, or seem to have had a different
@@ -1533,7 +1688,7 @@ and
.B Dt
is illogical, but as old versions of groff used this feature it is
kept for compatibility reasons.
-.\} \" @STUPID_DRAWING_POSITIONING
+.\} \" @STUPID_DRAWING_POSITIONING
.el \{\
.Topic
Temporarily, there existed some confusion on the positioning after the
@@ -1545,14 +1700,14 @@ groff drawing commands:
.
.RS
.P
-.I The position after a graphical object has been drawn is at its end;
+.I The position after a graphic object has been drawn is at its end;
.I for circles and ellipses, the "end" is at the right side.
.RE
.
.P
From this, the positionings specified for the drawing commands above
follow quite naturally.
-.\} \" @STUPID_DRAWING_POSITIONING
+.\} \" @STUPID_DRAWING_POSITIONING
.
.P
The differences between groff and classical troff are documented in
@@ -1591,11 +1746,11 @@ A reference like
refers to a manual page; here
.I groff
in section\~\c
-.I 7
+.I @MAN7EXT@
of the man-page documentation system.
.
-To read the example, look up section\~7 in your desktop help system or
-call from the shell prompt
+To read the example, look up section\~@MAN7EXT@ in your desktop help
+system or call from the shell prompt
.
.RS
.P
@@ -1607,11 +1762,10 @@ For more details, see
.BR man (1).
.
.TP
-.BR troff (@MAN1EXT@)
-.TP+
.BR groff (@MAN1EXT@)
-for getting the device-independent intermediate output from the shell
-prompt.
+option
+.B -Z
+and further readings on groff.
.
.TP
.BR groff (@MAN7EXT@)
@@ -1626,9 +1780,12 @@ for details on the device scaling parameters of the
file.
.
.TP
+.BR troff (@MAN1EXT@)
+generates the device-independent intermediate output.
+.
+.TP
.BR roff (@MAN7EXT@)
-for historical aspects, a list of the available postprocessors, and
-further readings.
+for historical aspects and the general structure of roff systems.
.
.TP
.BR groff_diff (@MAN7EXT@)
@@ -1636,8 +1793,20 @@ The differences between the intermediate output in groff and classical
troff.
.
.P
-The main source of information on all aspects of the groff system is
-the
+.BR \%grodvi (@MAN1EXT@),
+.BR \%grohtml (@MAN1EXT@),
+.BR \%grolbp (@MAN1EXT@),
+.BR \%grolj4 (@MAN1EXT@),
+.BR \%grops (@MAN1EXT@),
+.BR \%grotty (@MAN1EXT@)
+.br
+.RS
+the groff postprocessor programs.
+.RE
+.
+.P
+For a treatment of all aspects of the groff system within a single
+document, see the
.I groff info
.IR file .
.
@@ -1646,7 +1815,6 @@ It can be read within the integrated help systems, within
or from the shell prompt by
.
.RS
-.P
.ShellCommand info groff
.RE
.
@@ -1704,7 +1872,7 @@ described only parts of the
.I groff
extensions of the output language.
.
-It has been rewritten 2001 by
+It has been rewritten 2002 by
.MTO bwarken@mayn.de "Bernd Warken"
and is maintained by
.MTO wl@gnu.org "Werner Lemberg" .
diff --git a/src/devices/grohtml/post-html.cc b/src/devices/grohtml/post-html.cc
index 9843f513..43e52896 100644
--- a/src/devices/grohtml/post-html.cc
+++ b/src/devices/grohtml/post-html.cc
@@ -982,7 +982,6 @@ void page::add_and_encode (style *s, const string &str,
// start of escape
i += 2; // move over \(
int a = i;
- string troff_charname;
while ((i+1<str.length()) && (str.substring(i, 2) != string("\\)"))) {
i++;
}
@@ -992,7 +991,8 @@ void page::add_and_encode (style *s, const string &str,
else
n = -1;
if (n > 0) {
- html_glyph = get_html_translation(s->f, str.substring(a, n-a));
+ string troff_charname = str.substring(a, n-a);
+ html_glyph = get_html_translation(s->f, troff_charname);
if (html_glyph)
html_string += html_glyph;
else {
diff --git a/src/include/color.h b/src/include/color.h
index 9da07be5..6888da17 100644
--- a/src/include/color.h
+++ b/src/include/color.h
@@ -1,6 +1,11 @@
// -*- C++ -*-
-/* Copyright (C) 2001, 2002 Free Software Foundation, Inc.
- Written by Gaius Mulley <gaius@glam.ac.uk>
+
+/* <groff_src_dir>/src/include/color.h
+
+Last update: 10 Apr 2002
+
+Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+ Written by Gaius Mulley <gaius@glam.ac.uk>
This file is part of groff.
@@ -18,6 +23,7 @@ You should have received a copy of the GNU General Public License along
with groff; see the file COPYING. If not, write to the Free Software
Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+#include <stddef.h>
enum color_scheme {DEFAULT, CMY, CMYK, RGB, GRAY};
@@ -26,36 +32,45 @@ private:
color_scheme scheme;
unsigned int components[4];
- int read_encoding(color_scheme cs, const char *s, unsigned int n);
+ int read_encoding(const color_scheme, const char * const,
+ const size_t);
public:
enum {MAX_COLOR_VAL = 0xffff};
- color();
+ color() : scheme(DEFAULT){}
+ color(const color * const);
int operator==(const color & c) const;
int operator!=(const color & c) const;
int is_default() { return scheme == DEFAULT; }
+ // set color from given color component values
void set_default();
- void set_rgb(unsigned int r, unsigned int g, unsigned int b);
- void set_cmy(unsigned int c, unsigned int m, unsigned int y);
- void set_cmyk(unsigned int c, unsigned int m,
- unsigned int y, unsigned int k);
- void set_gray(unsigned int g);
+ void set_rgb(const unsigned int r, const unsigned int g,
+ const unsigned int b);
+ void set_cmy(const unsigned int c, const unsigned int m,
+ const unsigned int y);
+ void set_cmyk(const unsigned int c, const unsigned int m,
+ const unsigned int y, const unsigned int k);
+ void set_gray(const unsigned int g);
- int read_rgb(const char *s);
- int read_cmy(const char *s);
- int read_cmyk(const char *s);
- int read_gray(const char *s);
-
- color_scheme get_components(unsigned int *c);
-
- void get_rgb(unsigned int *r, unsigned int *g, unsigned int *b);
- void get_cmy(unsigned int *c, unsigned int *m, unsigned int *y);
+ // set color from a color string
+ int read_rgb(const char * const s);
+ int read_cmy(const char * const s);
+ int read_cmyk(const char * const s);
+ int read_gray(const char * const s);
+
+ // Return the actual color scheme and retrieve the color components
+ // into a predefined vector (of length at least 4).
+ color_scheme get_components(unsigned int *c) const;
+
+ // retrieve the components of a color
+ void get_rgb(unsigned int *r, unsigned int *g, unsigned int *b) const;
+ void get_cmy(unsigned int *c, unsigned int *m, unsigned int *y) const;
void get_cmyk(unsigned int *c, unsigned int *m,
- unsigned int *y, unsigned int *k);
- void get_gray(unsigned int *g);
+ unsigned int *y, unsigned int *k) const;
+ void get_gray(unsigned int *g) const;
};
#define Cyan components[0]
diff --git a/src/libs/libdriver/input.cc b/src/libs/libdriver/input.cc
index 4fcfb700..697af23b 100644
--- a/src/libs/libdriver/input.cc
+++ b/src/libs/libdriver/input.cc
@@ -8,7 +8,7 @@
Written by James Clark (jjc@jclark.com)
Major rewrite 2001 by Bernd Warken (bwarken@mayn.de)
- Last update: 5 Feb 2002
+ Last update: 10 Apr 2002
This file is part of groff, the GNU roff text processing system.
@@ -1342,11 +1342,20 @@ parse_D_command()
}
case 'f': // Df: set fill gray; obsoleted by DFg
{
- // convert arg and treat it like DFg
- ColorArg gray = color_from_Df_command(get_integer_arg());
+ IntArg arg = get_integer_arg();
+ if ((arg >= 0) && (arg <= 1000)) {
+ // convert arg and treat it like DFg
+ ColorArg gray = color_from_Df_command(arg);
+ current_env->fill->set_gray(gray);
+ }
+ else {
+ // set fill color to the same value as the current outline color
+ delete current_env->fill;
+ current_env->fill = new color(current_env->col);
+ }
+ pr->change_color(current_env);
// skip unused `vertical' component (\D'...' always emits pairs)
(void) get_integer_arg();
- current_env->fill->set_gray(gray);
// no positioning
skip_line_x();
break;
diff --git a/src/libs/libgroff/color.cc b/src/libs/libgroff/color.cc
index bfd79dcb..68e604c6 100644
--- a/src/libs/libgroff/color.cc
+++ b/src/libs/libgroff/color.cc
@@ -1,6 +1,11 @@
// -*- C++ -*-
-/* Copyright (C) 2001, 2002 Free Software Foundation, Inc.
- Written by Gaius Mulley <gaius@glam.ac.uk>
+
+/* <groff_src_dir>/src/libs/libgroff/color.cc
+
+Last update: 10 Apr 2002
+
+Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+ Written by Gaius Mulley <gaius@glam.ac.uk>
This file is part of groff.
@@ -31,7 +36,8 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "errarg.h"
#include "error.h"
-static inline unsigned int min(unsigned int a, unsigned int b)
+static inline unsigned int
+min(const unsigned int a, const unsigned int b)
{
if (a < b)
return a;
@@ -39,9 +45,13 @@ static inline unsigned int min(unsigned int a, unsigned int b)
return b;
}
-color::color()
-: scheme(DEFAULT)
+color::color(const color * const c)
{
+ scheme = c->scheme;
+ components[0] = c->components[0];
+ components[1] = c->components[1];
+ components[2] = c->components[2];
+ components[3] = c->components[3];
}
int color::operator==(const color & c) const
@@ -77,8 +87,12 @@ int color::operator!=(const color & c) const
return !(*this == c);
}
-color_scheme color::get_components(unsigned int *c)
+color_scheme color::get_components(unsigned int *c) const
{
+#if 0
+ if (sizeof (c) < sizeof (unsigned int) * 4)
+ fatal("argument is not big enough to store 4 color components");
+#endif
c[0] = components[0];
c[1] = components[1];
c[2] = components[2];
@@ -93,7 +107,8 @@ void color::set_default()
// (0, 0, 0) is black
-void color::set_rgb(unsigned int r, unsigned int g, unsigned int b)
+void color::set_rgb(const unsigned int r, const unsigned int g,
+ const unsigned int b)
{
scheme = RGB;
Red = min(MAX_COLOR_VAL, r);
@@ -103,7 +118,8 @@ void color::set_rgb(unsigned int r, unsigned int g, unsigned int b)
// (0, 0, 0) is white
-void color::set_cmy(unsigned int c, unsigned int m, unsigned int y)
+void color::set_cmy(const unsigned int c, const unsigned int m,
+ const unsigned int y)
{
scheme = CMY;
Cyan = min(MAX_COLOR_VAL, c);
@@ -113,8 +129,8 @@ void color::set_cmy(unsigned int c, unsigned int m, unsigned int y)
// (0, 0, 0, 0) is white
-void color::set_cmyk(unsigned int c, unsigned int m,
- unsigned int y, unsigned int k)
+void color::set_cmyk(const unsigned int c, const unsigned int m,
+ const unsigned int y, const unsigned int k)
{
scheme = CMYK;
Cyan = min(MAX_COLOR_VAL, c);
@@ -125,20 +141,21 @@ void color::set_cmyk(unsigned int c, unsigned int m,
// (0) is black
-void color::set_gray(unsigned int g)
+void color::set_gray(const unsigned int g)
{
scheme = GRAY;
Gray = min(MAX_COLOR_VAL, g);
}
/*
- * atoh - computes the value of the hex number S in N. LENGTH characters
- * are read. Returns 1 if successful.
+ * atoh - computes the decimal value of a hexadecimal number string.
+ * `length' characters of `s' are read. Returns 1 if successful.
*/
-static int atoh(unsigned int *n, const char *s, unsigned int length)
+static int atoh(unsigned int *result,
+ const char * const s, const size_t length)
{
- unsigned int i = 0;
+ size_t i = 0;
unsigned int val = 0;
while ((i < length) && csxdigit(s[i])) {
if (csdigit(s[i]))
@@ -151,55 +168,60 @@ static int atoh(unsigned int *n, const char *s, unsigned int length)
}
if (i != length)
return 0;
- *n = val;
+ *result = val;
return 1;
}
/*
- * read_encoding - reads a hexadecimal color string in S, using color
- * scheme CS with N components. Returns 1 if successful.
+ * read_encoding - set color from a hexadecimal color string.
+ *
+ * Use color scheme `cs' to parse `n' color components from string `s'.
+ * Returns 1 if successful.
*/
-int color::read_encoding(color_scheme cs, const char *s, unsigned int n)
+int color::read_encoding(const color_scheme cs, const char * const s,
+ const size_t n)
{
- int hex_length = 2;
+ size_t hex_length = 2;
scheme = cs;
- s++;
- if (*s == '#') {
+ char *p = (char *) s;
+ p++;
+ if (*p == '#') {
hex_length = 4;
- s++;
+ p++;
}
- for (unsigned int i = 0; i < n; i++) {
- if (!atoh(&components[i], s, hex_length))
+ for (size_t i = 0; i < n; i++) {
+ if (!atoh(&(components[i]), p, hex_length))
return 0;
if (hex_length == 2)
components[i] *= 0x101; // scale up -- 0xff should become 0xffff
- s += hex_length;
+ p += hex_length;
}
return 1;
}
-int color::read_rgb(const char *s)
+int color::read_rgb(const char * const s)
{
return read_encoding(RGB, s, 3);
}
-int color::read_cmy(const char *s)
+int color::read_cmy(const char * const s)
{
return read_encoding(CMY, s, 3);
}
-int color::read_cmyk(const char *s)
+int color::read_cmyk(const char * const s)
{
return read_encoding(CMYK, s, 4);
}
-int color::read_gray(const char *s)
+int color::read_gray(const char * const s)
{
return read_encoding(GRAY, s, 1);
}
-void color::get_rgb(unsigned int *r, unsigned int *g, unsigned int *b)
+void
+color::get_rgb(unsigned int *r, unsigned int *g, unsigned int *b) const
{
switch (scheme) {
case RGB:
@@ -232,7 +254,8 @@ void color::get_rgb(unsigned int *r, unsigned int *g, unsigned int *b)
}
}
-void color::get_cmy(unsigned int *c, unsigned int *m, unsigned int *y)
+void
+color::get_cmy(unsigned int *c, unsigned int *m, unsigned int *y) const
{
switch (scheme) {
case RGB:
@@ -263,7 +286,7 @@ void color::get_cmy(unsigned int *c, unsigned int *m, unsigned int *y)
}
void color::get_cmyk(unsigned int *c, unsigned int *m,
- unsigned int *y, unsigned int *k)
+ unsigned int *y, unsigned int *k) const
{
switch (scheme) {
case RGB:
@@ -315,7 +338,7 @@ void color::get_cmyk(unsigned int *c, unsigned int *m,
// we use `0.222r + 0.707g + 0.071b' (this is the ITU standard)
// as an approximation for gray
-void color::get_gray(unsigned int *g)
+void color::get_gray(unsigned int *g) const
{
switch (scheme) {
case RGB:
diff --git a/src/preproc/html/pre-html.cc b/src/preproc/html/pre-html.cc
index 41122e81..8e63c41b 100644
--- a/src/preproc/html/pre-html.cc
+++ b/src/preproc/html/pre-html.cc
@@ -512,7 +512,7 @@ static void write_start_image (IMAGE_ALIGNMENT pos, int is_html)
writeString("\\O[0]");
else
// reset min/max registers
- writeString("\\O[0]\\O[1]");
+ writeString("\\O[1]");
}
/*
diff --git a/src/roff/troff/env.cc b/src/roff/troff/env.cc
index eeca998c..933f68f9 100644
--- a/src/roff/troff/env.cc
+++ b/src/roff/troff/env.cc
@@ -725,6 +725,7 @@ environment::environment(const environment *e)
widow_control(e->widow_control),
#endif /* WIDOW_CONTROL */
ignore_next_eol(0),
+ emitted_node(0),
cur_glyph_color(e->cur_glyph_color),
prev_glyph_color(e->prev_glyph_color),
cur_fill_color(e->cur_fill_color),
@@ -810,6 +811,8 @@ void environment::copy(const environment *e)
hyphenation_space = e->hyphenation_space;
hyphenation_margin = e->hyphenation_margin;
composite = 0;
+ ignore_next_eol = e->ignore_next_eol;
+ emitted_node = e->emitted_node;
cur_glyph_color= e->cur_glyph_color;
prev_glyph_color = e->prev_glyph_color;
cur_fill_color = e->cur_fill_color;
diff --git a/tmac/www.tmac b/tmac/www.tmac
index 29346478..3d2d9351 100644
--- a/tmac/www.tmac
+++ b/tmac/www.tmac
@@ -494,7 +494,7 @@
. el \{\
. ie r ps4html \{\
. www-make-unique-name
-. nop \O[3]\O[5i\\*[www-unique-name].png]\O[0]\O[1]
+. nop \O[3]\O[5i\\*[www-unique-name].png]\O[1]
. nop \\m[\\*[www-dropcolor]]\\s[40]\\$1\\s0
. nop \O[2]\O[1]\O[4]
. \}
@@ -526,7 +526,7 @@
.\"
.de HTML-DO-IMAGE
. if r ps4html \
-. nop \O[3]\O[5\\$2\\$1.png]\O[0]\O[1]
+. nop \O[3]\O[5\\$2\\$1.png]\O[1]
. if \\n[www-html] \
. nop \O[3]\O[5\\$2\\$1.png]\O[0]
..