grunwald@flute.cs.uiuc.edu (Dirk Grunwald) (06/08/89)
The following diffs to xpr add a %%BoundingBox definition to the
postscript output from xps. It also implements a -psfig option that
suppresses the ``translate'' used to center the picture.
these options allow you to directly include xpr output into TeX documents
(and I would suspect TROFF) using psfig.
*** /tmp/,RCSt1a00993 Wed Jun 7 13:35:13 1989
--- xpr.c Wed Jun 7 13:23:18 1989
***************
*** 69,74 ****
--- 69,75 ----
#define F_REPORT 64
#define F_COMPACT 128
#define F_INVERT 256
+ #define F_PSFIG 512
char *infilename = "stdin", *whoami;
***************
*** 320,325 ****
--- 321,329 ----
if (!bcmp(*argv, "-portrait", len)) {
*flags |= F_PORTRAIT;
}
+ else if (!bcmp(*argv, "-psfig", len)) {
+ *flags |= F_PSFIG;
+ }
break;
case 'c': /* -compact */
***************
*** 860,866 ****
--- 864,872 ----
long clock;
int lm, bm; /* left (bottom) margin (paper in portrait orientation) */
+
printf ("%%!%s\n", COMMENTVERSION);
+ printf ("%%%%BoundingBox: 0 0 %d %d\n", (iw * 72)/300, (ih * 72)/300);
pswd = getpwuid (getuid ());
(void) gethostname (hostname, sizeof hostname);
printf ("%%%%Creator: %s:%s (%s)\n", hostname,
***************
*** 868,873 ****
--- 874,882 ----
printf ("%%%%Title: %s (%s)\n", infilename,name);
printf ("%%%%CreationDate: %s",
(time (&clock), ctime (&clock)));
+
+ /* include the bounding box for psfig */
+
printf ("%%%%EndComments\n");
dump_prolog(flags);
***************
*** 897,904 ****
}
/* set resolution to device units (300/inch) */
printf("72 300 div dup scale\n");
! /* move to lower left corner of image */
! printf("%d %d translate\n",lm,bm);
/* dump the bitmap */
printf("%d %d %d bitdump\n",iw,ih,scale);
} else { /* orientation == LANDSCAPE */
--- 906,917 ----
}
/* set resolution to device units (300/inch) */
printf("72 300 div dup scale\n");
!
! if ( !(flags & F_PSFIG) ) {
! /* move to lower left corner of image */
! printf("%d %d translate\n",lm,bm);
! }
!
/* dump the bitmap */
printf("%d %d %d bitdump\n",iw,ih,scale);
} else { /* orientation == LANDSCAPE */
***************
*** 931,938 ****
}
/* set resolution to device units (300/inch) */
printf("72 300 div dup scale\n");
/* move to lower left corner of image */
! printf("%d %d translate\n",lm,bm);
/* dump the bitmap */
printf("%d %d %d bitdump\n",ih,iw,scale);
}
--- 944,956 ----
}
/* set resolution to device units (300/inch) */
printf("72 300 div dup scale\n");
+
/* move to lower left corner of image */
! if ( !(flags & F_PSFIG) ) {
! /* move to lower left corner of image */
! printf("%d %d translate\n",lm,bm);
! }
!
/* dump the bitmap */
printf("%d %d %d bitdump\n",ih,iw,scale);
}
--
Dirk Grunwald -- Univ. of Illinois (grunwald@flute.cs.uiuc.edu)