Summary: | Converting attached PS file to PDF and back to PS gives broken fonts | ||
---|---|---|---|
Product: | Ghostscript | Reporter: | Till Kamppeter <till.kamppeter> |
Component: | PS Writer | Assignee: | Ken Sharp <ken.sharp> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | P4 | ||
Version: | 9.04 | ||
Hardware: | PC | ||
OS: | Linux | ||
Customer: | Word Size: | --- | |
Attachments: |
lp891074.ps
PDF file to exhibit the issue |
Description
Till Kamppeter
2011-11-16 11:34:11 UTC
Created attachment 8123 [details]
PDF file to exhibit the issue
The attached PDF file was created by running the original PostScript to PDF using pdfwrite, then removing most of the content. The remaining content (7 glyphs), when converted to PostScript using ps2write, produces the wrong rewsult for all but one of the glyphs.
I'm assuming its the ps2write step which is causing the problem, since the PDF renders correctly in Acrobat and Ghostscript
The problem was in the handling of format 4 CMAP subtables in TrueType fonts. These are used to map character codes to Glyph IDs so that the proper GLYF program can be found. Format 4 is used for discontinuous ranges of mappings, but the ps2write header was treating them as continuous, and starting from 0. So for example, if a range contained a single character code 0x2 which mapped to GID 0x102 the existing code would have mapped character code 0x0 to GID 0x102 instead. This caused many glyphs to be incorrectly mapped, often to the .notdef glyph. Fixed in Git commit: cd8f3973ac735480fcd02de9e0214de80ea79e94 Regression testing exhibits several useful progressions in the test suite. I applied the patch to the GS package of Ubuntu Oneiric and it works. Thank you very much for the quick fix. |