Date: Thu, 15 Nov 2001 22:07:55 +0100 (CET) From: Helge Oldach <send-pr@oldach.net> To: FreeBSD-gnats-submit@freebsd.org Subject: ports/32018: ports/graphics/tiff fix for fax2ps Message-ID: <200111152107.fAFL7tf36775@sep.oldach.net>
next in thread | raw e-mail | index | archive | help
>Number: 32018 >Category: ports >Synopsis: ports/graphics/tiff fix for fax2ps >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Nov 15 13:10:00 PST 2001 >Closed-Date: >Last-Modified: >Originator: Helge Oldach >Release: FreeBSD 4.4-STABLE i386 >Organization: >Environment: System: FreeBSD sep.oldach.net 4.4-STABLE FreeBSD 4.4-STABLE #4: Sat Nov 3 16:16:29 CET 2001 toor@sep.oldach.net:/usr/obj/usr/src/sys/GENERIC i386 >Description: fax2ps does not behave correctly for non-Letter paper sizes. There are two problems which are fixed by the patch below: Without scaling (-S) the fax is now centered on the page size specified with -H and/or -W. Before, fax2ps was using an obscure and practially useless algorithm to allocate the image relative to Letter sized paper which sometime sled to useless whitespace on the paper, while at the same time cutting of the faxes printable area at the opposite border. Second, scaling now preserves aspect ratio, which makes unusual faxes (in particular short ones) print properly. In fact it also simplifies the code to do the scaling. :-) This patch has been submitted to tiff@sgi.com a while ago already but has not been implemented yet. >How-To-Repeat: >Fix: --- tools/fax2ps.c.orig Tue Sep 2 19:54:34 1997 +++ tools/fax2ps.c Sat Feb 13 16:43:01 1999 @@ -151,7 +151,7 @@ { uint32 w, h; uint16 unit; - float xres, yres; + float xres, yres, scale = 1.0; tstrip_t s, ns; TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &h); @@ -174,21 +174,13 @@ printf("%%%%Page: \"%d\" %d\n", pageNumber, pageNumber); printf("/$pageTop save def gsave\n"); - if (scaleToPage) { - float yscale = pageHeight / (h/yres); - float xscale = pageWidth / (w/xres); - printf("%d %d translate\n", - (int) (((basePageWidth - pageWidth) * points) * half), - (int)((yscale*(h/yres)*points) + - (basePageHeight - pageHeight) * points * half) ); - printf("%g %g scale\n", (72.*xscale)/xres, -(72.*yscale)/yres); - } else { - printf("%d %d translate\n", - (int) ((basePageWidth - pageWidth) * points * half), - (int)((72.*h/yres) + - (basePageHeight - pageHeight) * points * half) ); - printf("%g %g scale\n", 72./xres, -72./yres); - } + if (scaleToPage) + scale = pageHeight / (h/yres) < pageWidth / (w/xres) ? + pageHeight / (h/yres) : pageWidth / (w/xres); + printf("%g %g translate\n", + points * (pageWidth - scale*w/xres) * half, + points * (scale*h/yres + (pageHeight - scale*h/yres) * half)); + printf("%g %g scale\n", points/xres*scale, -points/yres*scale); printf("0 setgray\n"); TIFFSetField(tif, TIFFTAG_FAXFILLFUNC, printruns); ns = TIFFNumberOfStrips(tif); >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200111152107.fAFL7tf36775>