Summary: | File rendered with portions of characters missing | ||
---|---|---|---|
Product: | Ghostscript | Reporter: | Marcos H. Woehrmann <marcos.woehrmann> |
Component: | PDF Interpreter | Assignee: | Robin Watts <robin.watts> |
Status: | NOTIFIED FIXED | ||
Severity: | normal | ||
Priority: | P1 | ||
Version: | master | ||
Hardware: | PC | ||
OS: | Linux | ||
Customer: | 170 | Word Size: | --- |
Attachments: |
lost_doc.pdf
lost_doc.png test_page.pdf lost_cutdown.pdf |
Description
Marcos H. Woehrmann
2010-11-21 22:49:40 UTC
Created attachment 6934 [details]
lost_doc.pdf
Created attachment 6935 [details]
lost_doc.png
Created attachment 6936 [details]
test_page.pdf
The text is created by drawing a masked image. The text is a mask and the image has a few black rectangles placed under the lines of text. Both the image and mask have interpolation flag on. Ghostscript appears to misplace the image when it renders the masked image with interpolation. -dNOINTERPOLATE flag can be used to work around the problem. Created attachment 6948 [details]
lost_cutdown.pdf
Cutdown PDF file to show the problem. The vast majority of the content in the original file (all the text) is actually not used; the final image is purely a masked image.
In gxclipm.c, in clip_runs_enumerate, the code runs through detecting horizontal runs of pixels. When it finds one, it does not process it immediately, but keeps it in a one place buffer 'prev'. This enables it to check the next run it finds - if it is directly below the previous one, then it combines the two. If not, it should output the previous one, and keep the current one as the previous one for next time around. Unfortunately the code got this wrong; if it fails to match, it outputs the current one, and keeps the current one as the previous one. The net effect is that the first run on every line is (usually) lost. The fix is simple: Index: gs/base/gxclipm.c =================================================================== --- gs/base/gxclipm.c (revision 11916) +++ gs/base/gxclipm.c (working copy) @@ -279,7 +279,7 @@ prev.q.y = ty + 1; else { if (prev.q.y > prev.p.y) { - code = (*process)(pccd, tx1, ty, tx, ty + 1); + code = (*process)(pccd, prev.p.x, prev.p.y, prev.q.x, prev.q.y); if (code < 0) return code; } Fixed in commit 11916. |