Received: by whizzer.wpd.sgi.com (/911001.SGI)
	 id AA03173; Fri, 12 Nov 93 11:12:25 GMT
Received: from sgi.sgi.com by whizzer.wpd.sgi.com via SMTP (/911001.SGI)
	for /usr/people/sam/majordomo/wrapper resend -l tiff -h sgi.sgi.com -f tiff-owner -s -m "-oi -odq -om" tiff-list id AA03166; Fri, 12 Nov 93 03:12:22 -0800
Received: from dxmint.cern.ch by sgi.sgi.com via SMTP (931106.SGI.IRIX4/910110.SGI)
	for tiff-relay@whizzer.wpd.sgi.com id AA27965; Fri, 12 Nov 93 03:12:18 -0800
Received: from macmail.cern.ch by dxmint.cern.ch (5.65/DEC-Ultrix/4.3)
	id AA13401; Fri, 12 Nov 1993 12:12:16 +0100
Message-Id: <9311121112.AA13401@dxmint.cern.ch>
Date: 12 Nov 1993 11:51:22 U
From: "Achille Petrilli" <Achille_Petrilli@macmail.cern.ch>
Subject: fax2ps improvements (??)
To: "TIFF Reports" <tiff@sgi.sgi.com>
Sender: tiff-owner@sgi.sgi.com

                       Subject:                               Time:11:44
  OFFICE MEMO          fax2ps improvements (??)               Date:93/11/12
Hi,
I've slightly modified fax2ps to make it more suited for Europe
(no more fixed paper size, the printer decides what paper size is available)
and I added a -F option to fit the image to the paper while retaining the x/y
ratio of the image.
While I was at it, I also added a calculation to find out whether the shape
of the image is more suited for portrait or landscape printing, and I generate
the appropriate rotation as needed.
I would like to thank you for making available such a good software.
I successfully compiled the modified fax2ps.c on a Sun using the ANSI C
compiler
from Sun. I believe that should just compile everywhere.
Cheers,
   Achille Petrilli

Here are the diffs between my version and the 3.2+patch fax2ps.c version as
available on sgi.com:
----- cut here -----
37d36
< int   fitToPage = FALSE;      /* if true, fit raster to page dimensions */
401d399
<     int rotate;
478,481d475
<     /*
<      * AP: if width > length ==> rotate the whole page !!.
<      */
<     rotate = w > h;
485,523c479,482
<       float ypoint = 72.*h/yres;
<       float xpoint = 72.*w/xres;
< 
<       printf("gsave\n");
<       printf("clippath pathbbox\n");
<       printf("grestore\n");
<       printf("3 2 roll %% llx urx ury lly\n");
<       printf("sub /pH exch def exch sub /pW exch def\n");
<       if (rotate) {
<           printf("90 rotate\n");
<           printf("/yS pW %f div def\n",ypoint);
<           printf("/xS pH %f div def\n",xpoint);
<       } else {
<           printf("/yS pH %f div def\n",ypoint);
<           printf("/xS pW %f div def\n",xpoint);
<           printf("0 yS %d mul translate\n", (int)((h/yres)*72.));
<       }
<       printf("xS %g mul yS %g mul scale\n", 72./xres, -72./yres);
<     } else if (fitToPage) {
<       float ypoint = 72.*h/yres;
<       float xpoint = 72.*w/xres;
< 
<       printf("gsave\n");
<       printf("clippath pathbbox\n");
<       printf("grestore\n");
<       printf("3 2 roll %% llx urx ury lly\n");
<       printf("sub /pH exch def exch sub /pW exch def\n");
<       if (rotate) {
<           printf("90 rotate\n");
<           printf("/yS pW %f div def\n",ypoint);
<           printf("/xS pH %f div def\n",xpoint);
<           printf("xS yS lt {/yS xS def} {/xS yS def} ifelse\n");
<       } else {
<           printf("/yS pH %f div def\n",ypoint);
<           printf("/xS pW %f div def\n",xpoint);
<           printf("xS yS lt {/yS xS def} {/xS yS def} ifelse\n");
<           printf("0 yS %d mul translate\n", (int)((h/yres)*72.));
<       }
<       printf("xS %g mul yS %g mul scale\n", 72./xres, -72./yres);
---
>       float yscale = pageHeight / (h/yres);
>       float xscale = pageWidth / (w/xres);
>       printf("0 %d translate\n", (int)(yscale*(h/yres)*72.));
>       printf("%g %g scale\n", (72.*xscale)/xres, -(72.*yscale)/yres);
525,529c484
<       if (rotate) {
<           printf("90 rotate\n");
<       } else {
<           printf("0 %d translate\n", (int)(72.*h/yres));
<       }
---
>       printf("0 %d translate\n", (int)(72.*h/yres));
621c576
<     while ((c = getopt(argc, argv, "p:x:y:W:H:aswzSF")) != -1)
---
>     while ((c = getopt(argc, argv, "p:x:y:W:H:aswzS")) != -1)
626,628d580
<       case 'F':               /* scale to page */
<           fitToPage = TRUE;
<           break;
642,643c594,595
<           if (pageNumber < 0) {
<               fprintf(stderr, "%s: Invalid page number (must be >= 0).\n",
---
>           if (pageNumber < 1) {
>               fprintf(stderr, "%s: Invalid page number (must be > 0).\n",
670c622
< "usage: %s [-a] [-w] [-p pagenumber] [-x xres] [-y res] [-s] [-F] [-S] [-W
pagewidth] [-H pageheight] [files]\n",
---
> "usage: %s [-a] [-w] [-p pagenumber] [-x xres] [-y res] [-s] [-S] [-W
pagewidth] [-H pageheight] [files]\n",





