[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Groff] sqtroff / groff diffs - escape sequences

From: Ted Harding
Subject: RE: [Groff] sqtroff / groff diffs - escape sequences
Date: Tue, 12 Feb 2002 18:23:42 -0000 (GMT)

On 12-Feb-02 Andy Crichton wrote:
> I have converted all of the []'s to '''s but there is
> still the matter of \D'b and \D'w
> \D'b dh dv '
> is to draw a box from the current position of width dh
> (defaults to points) and length dv(in vertical line space)
> from the current position.

I guess \D'b...' was a sqtroff extension to the original Unix
troff (which doesn't have this). Groff goes one further, with
\D'p ... ' and \D'P ... ' (draw unfilled and filled polygons),
so in fact it doesn't need \D'b' since this is a special case.
Usage: \D'p dx1 dy1 dx2 dy2 ... dxl dyk' and similar for \D'P'.

(See man groff_out). The polygon will automatically be closed
if sum(dxi) and sum(dyi) do not come back to the start.
To draw a series of connected line segments (polyline)
use a series of \D'l dx dy'.

Note, however (unless Werner/Bernd has already changed it)
that the final position is at (sum(dxi), sum(dyi)).
Hence it can be worth using \Z'\D'p ...'' so that you at
least know where you are (i.e. where you started).

> I presume I can get the current position from a register
> and draw the box with explicit positions instead?

Not conveniently, and it's tricky. Nor is it clear why you
need to. However, \n[.h] (as in Unix troff) is the "current
text baseline high-water mark", i.e. essentially your vertical
position from the top of the page. The escape sequence \kX
marks the current horizontal _inout_ place in register X,
and this may not be the same as the horizontal position
in the output.

If you need to place something (e.g. a box) at an absolute
position on the page, it's better to use the "|" absolute
motion modifier, combined if necessary with \Z'...'.
For instance, wherever you are,


will do "something" at the position 2 inches from the left
and 3 inches down from the top, and then take you back to
where you were.

> \D'w sets the gray scale or resets it to it's previous
> setting if there are no arguments. The example from the
> sqtroff book for white text on a black background is
> \D[f 1]\D[b (u;\n[.l]-\n[.i]) 1.2v]\D[w 1]\D[f 0]
> Is there a separate register for the grayscale of text and
> other drawn objects in groff?

I don't think there's an accessible register from which you
can read what it is. However, to set the grey-scale for filling
drawn objects, use \D'f nnn' (see man groff_out again). This
doesn't affect text -- only filled circles (\D'C...'), ellipses
(|D'E...') and polygons (\D'P...'). nnn is a number from 0 to 1000,
and the larger it is the blacker it is. Note, again, that the
command \D'nnn' has a side-effect that the current point moves
right by nnn machine units, so usually you will want to undo that.
Either use \Z'\D'f nnn'', which ensures no motion regardless
of nnn, or use \D'f nnn'\h'-nnnu'.

To change the colour of text requires a different approach.
It's straightforward with PostScript, since you can plant
the PostScript setgray and setrgbcolor commands using the
\X'ps: setgray' (0<= <= 1, where 0 = black
and 1 = white); and \X'ps: r g b setgrbcolor' where r, g, b
are also between 0 and 1. "setgray" and "setrgbcolor"
will change the gray-level or colour of everything..

> I am trying to achieve a box containing black text with a grayscale
> background so there is a .AA
> some text
> .BB
> where .AA starts the box section and .BB ends it

You need to get the macro .BB to draw the box along the lines of
\Z'\D'f 150'\D'P dx1 dy1 dx2 dy2 dx3 dy3''Some Text

Note you need to draw the filled box, then print the text; otherwise
the box will overwrite the text.

Hope this helps,

E-Mail: (Ted Harding) <address@hidden>
Fax-to-email: +44 (0)870 167 1972
Date: 12-Feb-02                                       Time: 18:23:42
------------------------------ XFMail ------------------------------

reply via email to

[Prev in Thread] Current Thread [Next in Thread]