Bug 689775 - pswrite produces bad EPS with accumulating vertical shifts
Summary: pswrite produces bad EPS with accumulating vertical shifts
Status: RESOLVED WONTFIX
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: PS Writer (show other bugs)
Version: 8.15
Hardware: Other Linux
: P4 minor
Assignee: Ken Sharp
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-03-31 16:24 UTC by Cengiz Gunay
Modified: 2010-08-06 13:55 UTC (History)
0 users

See Also:
Customer:
Word Size: ---


Attachments
EPS file that cannot be properly handled by pswrite (543.23 KB, application/postscript)
2008-03-31 16:26 UTC, Cengiz Gunay
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Cengiz Gunay 2008-03-31 16:24:52 UTC
For the attached EPS file, the pswrite device produces accumulating vertical 
shifts in lines even though gs can properly display the file with the x11 
device.

To reproduce:
$ gv broken.eps
$ eps2eps broken.eps gs-out.eps
$ gv gs-out.eps

The two images on the screen should differ if superposed.

System:
openSUSE 10.3 (X86-64), kernel 2.6.22.12

GS:
ESP Ghostscript 8.15 (2006-04-19)
Comment 1 Cengiz Gunay 2008-03-31 16:26:29 UTC
Created attachment 3908 [details]
EPS file that cannot be properly handled by pswrite

The file was originally produced by OpenOffice "Save as EPS" option from a
Metafile object.
Comment 2 Alex Cherepanov 2008-03-31 18:45:45 UTC
The effect is small but obvious when the source and result files are compared
against each other. ESP Ghostscript is an obsolete, unofficial fork but
the problem also exists in the current development version.

The bug is caused by deliberate reduction of output precision to save the file
size. Commenting out this misfeature fixes the problem at the cost of
1.5 times larger output file.

/*
 * We redefine path tracing to use a compact form for polygons; also,
 * we only need to write coordinates with 2 decimals of precision,
 * since this is 10 times more precise than any existing output device.
 */
static inline double
round_coord2(floatp v)
{
    return v; // floor(v * 100 + 0.5) / 100.0;
}

There's another approach - track the error between the precise and rounded
position and adjust relative movements to keep the error within the
selected precision.

Comment 3 Ray Johnston 2008-04-17 09:56:30 UTC
Alex didn't say what file the patch goes in, but I think it is src/gdevps.c
Comment 4 Ken Sharp 2010-08-06 13:55:58 UTC
pswrite is effectively unsupported, but the supplied patch may be used to resolve the problem. We intend to carry on developing ps2write in the future as the replacement for pswrite.