Bug 689819 - PDF q and Q operators inside paths
Summary: PDF q and Q operators inside paths
Status: NOTIFIED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: PDF Interpreter (show other bugs)
Version: 8.62
Hardware: PC Linux
: P4 major
Assignee: Alex Cherepanov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-05-05 02:59 UTC by Piotr Strzelczyk
Modified: 2008-12-19 08:31 UTC (History)
0 users

See Also:
Customer:
Word Size: ---


Attachments
Example PDF (1.81 KB, application/pdf)
2008-05-05 03:00 UTC, Piotr Strzelczyk
Details
Ghostscript interpretation of example (4.16 KB, image/png)
2008-05-05 03:01 UTC, Piotr Strzelczyk
Details
Adobe Reader screenshot of example (47.70 KB, image/png)
2008-05-05 03:02 UTC, Piotr Strzelczyk
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Piotr Strzelczyk 2008-05-05 02:59:11 UTC
According to PDF documentation, 'q [some code] Q' used 'inside' path shouldn't
change the current path (unlike in PostScript).
In Ghostscript this behaviour is defined in lib/pdf_ops.ps (/grestore_nopath).
But if you change CTM between 'q' & 'Q', you will get unexpected effect:
after the `Q' operator the applied transformation changes the existing path.

I uploaded short PDF (nearly minimal example) with such construction,
and the results of rendering it in Ghostscript and Acrobat Reader.
Comment 1 Piotr Strzelczyk 2008-05-05 03:00:16 UTC
Created attachment 3980 [details]
Example PDF
Comment 2 Piotr Strzelczyk 2008-05-05 03:01:53 UTC
Created attachment 3981 [details]
Ghostscript interpretation of example
Comment 3 Piotr Strzelczyk 2008-05-05 03:02:35 UTC
Created attachment 3982 [details]
Adobe Reader screenshot of example
Comment 4 Alex Cherepanov 2008-05-06 14:06:44 UTC
Fix and simplify implementation of operator Q. Collecting the path with
the current ctm and re-playing it with the restored ctm transforms the
path exactly as PDF needs.

The following patch is committed as a rev. 8707.
http://ghostscript.com/pipermail/gs-cvs/2008-May/008288.html

Current regression testing shows no differences.
The sample file from this bug will be added to the public test suite
by the next revision.