Embedding post-script images in troff text

Axel Mahler axel at coma.UUCP
Thu Feb 11 23:29:27 AEST 1988


In article <901 at ora.UUCP> tim at ora.UUCP (Tim O'Reilly) writes:
+>In article <4594 at venera.isi.edu>, cracraft at venera.isi.edu (Stuart Cracraft) writes:
+>> Is there a way to embed post-script images in troff text?
+>> For example, the PostScript language could be used to produce
+>> a fancy table or image, and this PostScript language and/or
+>> image could somehow be inserted in the middle of a troff
+>> document.
+>> 
+>
( descriptions how to do it )
+>Of course, when you do any of these things, you must make allowances,
+>in troff, for spacing and so forth, so troff and the output device 
+>don't get out of sync!  For example, if you are going to
+>interpolate the contents of a PostScript file containing a
+>figure, you must tell troff to space down, or else it will
+>resume printing at the original position, right on top of
+>the figure.
+>
( more descriptions of possible interferences of generated with included
PostScript )

All the problems you have mentioned here are tackled by the
'Encapsulated PostScript File format' (EPSF), defined by Adobe. EPSF
gives rules for writing/generating 'well-behaved' PostScript programs.
EPSF files also contain BoundingBox defintions, giving the
angle-points for the smallest rectangle containing the entire figure.
This format gives text processing programs (as TeX for instance, there
are problems with troff) the opportunity to extract the necessary
amount of space from the picture itself. Even better: as PostScript
allows arbitrary scaling of figures, one is able to define the size of
a figure box from within the text processor and later fit (i.e. scale)
the figure into this box. So, the optical appearance of the printed
document isn't dominated by the picture's natural dimensions but the
picture fits conveniently into the layout concept of the document.

The latter mechanism gives even troff a chance. All you need is a
program to be called (e.g. by means of .sy) from within the text
processor with parameters specifying the dimensions a picture shall
have in the output, and the name of the file containing the PostScript
description. This program would scan the PostScript file for the
BoundingBox information, and compute necessary scalings and
translations to fit the picture into the given area on the output
page. Taking this approach, linking a picture into troff could
look like:

     .sy fitps -llx=1.4i -lly=3.2i -urx=6.0i -ury=8.4i mypict.eps

+>I find the .sy request particularly useful, since you can

I do too, for obvious reasons. Which version of ditroff introduces the
various requests (.cf, .sy in particular) you mentioned ?  We have
troff of DWB 1.0 which lacks the .sy feature. To make a mechanism work
that is similar to the one described above, we had to hack our
ditroff->PostScript driver.

cheers, Axel.

-- 
Axel Mahler, Tech.Univ. Berlin

UUCP: axel at coma.uucp (unido!coma!axel)
BITNET: axel at db0tui62.bitnet



More information about the Comp.unix.questions mailing list