Bug 692626

Summary: pdf2ps produces broken PostScript output on a PDF file with LibreOffice output
Product: Ghostscript Reporter: Till Kamppeter <till.kamppeter>
Component: PS WriterAssignee: Ken Sharp <ken.sharp>
Status: RESOLVED FIXED    
Severity: normal CC: jackie.rosen
Priority: P4    
Version: 9.04   
Hardware: PC   
OS: Linux   
Customer: Word Size: ---
Attachments: printout.pdf
Output from printout.pdf converted by ps2write.

Description Till Kamppeter 2011-10-23 19:09:34 UTC
Created attachment 8039 [details]
printout.pdf

Running

pdf2ps printout.pdf
gs printout.ps

shows letters replaced by "''.

Same result with

gs -sDEVICE=ps2write -sOutputFile=printout.ps printout.pdf

printout.pdf is attached.

I am using Ghostscript 9.04 on Ubuntu Oneiric, 64-bit.

See also

https://bugs.launchpad.net/ubuntu/+source/ghostscript/+bug/879977

This is similar to bug 692624 perhaps even the same problem.
Comment 1 Till Kamppeter 2011-10-23 19:14:44 UTC
Also this problem only occurs with "ps2write" as output device, not with "pswrite", "pdfwrite", or "png16m", like bug 692624.
Comment 2 Ken Sharp 2011-11-10 08:46:49 UTC
Created attachment 8093 [details]
Output from printout.pdf converted by ps2write.

> Running
> 
> pdf2ps printout.pdf
> gs printout.ps
> 
> shows letters replaced by "''.

Till can you be specific about which letters ? I've attached the output I get from the current HEAD. When this PostScript file is run through the current GS HEAD to the display device I can't see any problems. However, I don't speak Italian at all, so I could well be missing the issue.

There are 3 or so places where the ' character appears, but these seem to be present in the original PDF as well.
Comment 3 Ken Sharp 2011-11-10 08:49:30 UTC
(In reply to comment #2)

> Till can you be specific about which letters ? I've attached the output I get
> from the current HEAD. When this PostScript file is run through the current GS
> HEAD to the display device I can't see any problems.

Hmm, it may be that this has been fixed....

I just retried #692624 where I did previously see a problem, and that issue seems to have disappeared.

I'll see if I can use Git bisect to find the revision where this happened.
Comment 4 Ken Sharp 2011-11-10 08:56:32 UTC
(In reply to comment #3)
> (In reply to comment #2)
> 
> > Till can you be specific about which letters ? I've attached the output I get
> > from the current HEAD. When this PostScript file is run through the current GS
> > HEAD to the display device I can't see any problems.
> 
> Hmm, it may be that this has been fixed....
> 
> I just retried #692624 where I did previously see a problem, and that issue
> seems to have disappeared.

False alarm. For some reason the current HEAD output PDF instead of PostScript, I must have mis-typed the command line. I now do see the issue.
Comment 5 Ken Sharp 2011-11-11 10:29:08 UTC
Just to report some progress.

The problem 'seems' to be that we are writing a broken (or at least very odd) CMAP subtable into the subset TrueType font we embed in the PostScript file. This seems to depend purely on the size of the font, that is the number of glyphs present.

I'm debugging my way through the TTF writing code to try and determine why.
Comment 6 Ken Sharp 2011-11-12 12:34:47 UTC
The problem is that we were not assigning a name entry for the second (and subsequent) parts of a composite glyph, but we were assigning a glyph entry. The mismatch between the two tables caused the CMAP subtable to be written incorrectly.

I have a potential fix which I am currently testing.
Comment 7 Ken Sharp 2011-11-12 12:35:21 UTC
*** Bug 692624 has been marked as a duplicate of this bug. ***
Comment 8 Ken Sharp 2011-11-14 10:43:19 UTC
I believe this is fixed with revision:

08dc12934adaa27978ec264dbf9c691a18d8c429

Testing showed 2 progressions in our test suite, and one regression which I will need to look at further. However the progressions seem important enough to incorporate now.