[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Groff] Questions re: Embedding encapsulated PostScript page in groff pa
[Groff] Questions re: Embedding encapsulated PostScript page in groff page
Fri, 03 Mar 2006 22:06:18 -0700
Thunderbird 1.5 (Windows/20051201)
I have several questions that I'd like to understand the answers
to, and I'm raising them here because others might be able to
I have been attempting to follow Ted Harding's explanation on how
to embed encapsulated PostScript into a groff page. After some
false starts and failed attempts, I finally discovered the grops(1)
man page so his explanations started making a lot more sense,
especially after seeing the explanation of .PSPIC, etc.
I now have a PS page with a pie chart and associated text in a file.
I added the two opening lines to identify the PostScript version
and bounding box values, then removed the showpage at the end of the
(one-page) file so it would qualify as EPS.
I am using some macros I wrote in conjunction with my groff file.
Each new page in the groff text file calls a page-setup macro followed
by another macro that creates a full-page colored background by
drawing a full-page box, then filling it with the specified color.
I then used the \X'ps: import file.epx llx lly urx ury width'
request to import the file, and with the a particular selection
of argument values in the \X line, it works as it should.
Now I'd like to understand just dimensioning and positioning is
handled by groff when the file is imported, particularly how the
bounding box values are used.
I can see the 0 0 612 792 bounding box as being a full 8-1/2" by
11" page (612 points wide and 792 points high), and if I want to
import the entire page into groff and send it to the PS output file
I would use the same values for the arguments to the \X'ps: import...'
request. If I am importing a full page and I want it to output as a
full page, then it makes sense to set the "width" parameter to 612000
groff units (1000 units per point). I think I understand that
Now I'd like to understand: How do things work if I am importing
only part of the EPS page? If I specify the four bounding box
arguments in the EPS file, it seems that I would select the x,y
coordinates (relative to the lower left-hand corner of the PS
page) for the lower-left and upper-right corners of the area I want
to encapsulate for import by groff. Thus, if I have a rectangular
area in the center of the page (x,y = 306, 396) (centered vertically
and horizontally) that is 500 points wide and 300 points high, the
lower left corner would be (306 - 250),(396 - 150) or 56,246 and the
upper right corner would be (306 + 250),(396 + 150) or 555,546. Thus
the four arguments to bounding box would be "56 246 555 546".
If this is correct, then I understand the encapsulation bounding
My next point of uncertainty pertains the to bounding box parameters
for the \X'ps: import...' request inside the groff source file.
Obviously, I can use the same parameters as I used in the EPS file,
and that would be cleanest. However, suppose they don't match. What
I surmise that when I specify the bounding box for the import
operation, the parameters for llx lly urx ury define a rectangular
area (sized in points) that defines the size and aspect ratio of
the area alloted to the file being imported. That area is then
scaled so that it occupies the number of groff units left-to-right
specifed in the "width" parameter, and the height is scaled by the
Question: Is it required that the bounding box values for the
imported file be identical to the groff file? If not and the
groff box dimensions are smaller, is the imported image clipped
to fit? If the groff box is larger, is the image centered in the
As for the "width" parameter, is the area (1)centered in the current
line-width part of the page or is it (2)placed against the left side
of the paper or (3) placed against the page offset (or margin)?
I find nothing in the grops man page that answers these questions,
at least in a way that I have been able to discover...
My last question has to do with placement on the page. It appears
that I must space down the groff page to the location where the
bottom of the space imported EPS image is to be located, then
the image appears above that vertical position. Is this correct?
It seems to be not the case, because if an image is located near
the top of the PostScript page then encapsulated, it seems to
require that I space down to the bottom of the groff page before
I import the EPS file. If I don't, I get an error telling me that
the image runs off the top of the page.
It's only been a few days since I started sporadically looking at
PostScript, but I already like the things you can do with it. It
just requires a rather large vocabulary, not unlike groff and Unix...
Thanks for your help through this confusion.
- [Groff] Questions re: Embedding encapsulated PostScript page in groff page,
Clarke Echols <=