groff
[Top][All Lists]
Advanced

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

Re: [Groff] Re-using PSPIC insertions


From: Tadziu Hoffmann
Subject: Re: [Groff] Re-using PSPIC insertions
Date: Wed, 2 Apr 2003 14:41:52 +0200
User-agent: Mutt/1.4i

Don't let yourself get confused by the terms "ps: def" and
"ps: exec".  The *only* difference between the two is that
stuff in "ps: def" gets placed at the beginning of the
output file and is therefore only executed once by the
PostScript interpreter, whereas stuff in "ps: exec" gets
placed in the context of where it is encountered in the
*roff file and is therefore executed every time it appears.
("ps: import" is essentially the same as "ps: exec" with the
contents of the file (and a scaled coordinate system.))

Of course it usually makes sense to place procedure
definitions in "ps: def", since normally these definitions
remain the same during the whole job, and always redefining
variables with the same contents would be pointless.
However, in your case you want "rS" to change, so your
definition should be placed in a "ps: exec" instead of a
"ps: def".

Concerning the reuse of a graphic image defined in an EPS
file, my suggestion would be to try to understand what the
file does and manually split up the contents into a
"definition" part (which remains constant and can be placed
into a "ps: def") and an "execution" part (which uses the
variables defined in the "definition" part) that can be
placed into a character definition using "ps: exec" (like
the "rose" character in the example in
http://www.ffii.org/archive/mails/groff/2001/Dec/0068.html).

Always "importing" the EPS file every time it is needed
(which is what .PSPIC does) would of course also work, but
is terribly inefficient.  A simple "mechanical" definition
a la

\X'ps: def \
/myepsfile { \
<content of EPS file goes here> \
} def'
.ds XX \X'ps: exec myepsfile'
\*[XX] \*[XX] \*[XX]

usually isn't much better.

Caching a bitmap for reuse seems somewhat cumbersome to me
(in particular if you redraw the picture using the "image"
operator, since it resamples the bitmap), unless you define
a font and use the builtin character caching mechanism.  But
you might try the "user path" stuff mentioned in the PLRM.



reply via email to

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