The customer reports and I've verified that the two attached PDF files are rendered by Ghostscript 9.00 and head (r11906) with the first characters of each line plus some other misc. characters partially missing (see lost_doc.png for an example output). The command line I'm using for testing: bin/gs -sDEVICE=ppmraw -r300 -o lost_doc.ppm ./lost_doc.pdf Note that versions before r11704 cannot process the lost_doc.pdf file at all, the generate an error. Also, this does not appear to be a JBIG2 decoding issue, running with the Luratech decoder results in an identical output image.
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.