Summary: | Problem reading PDF file with CID font | ||
---|---|---|---|
Product: | Ghostscript | Reporter: | Marcos H. Woehrmann <marcos.woehrmann> |
Component: | Text | Assignee: | Alex Cherepanov <alex> |
Status: | NOTIFIED FIXED | ||
Severity: | normal | ||
Priority: | P1 | ||
Version: | master | ||
Hardware: | All | ||
OS: | All | ||
Customer: | 531 850 | Word Size: | --- |
Attachments: |
002_simple.pdf
experimental patch - uses wrong encoding patch patch |
Description
Marcos H. Woehrmann
2008-03-25 10:39:40 UTC
Created attachment 3887 [details]
002_untergeschoss.pdf
Created attachment 3888 [details]
001_übersicht_200.pdf
Created attachment 3890 [details]
002_simple.pdf
Much simplified version of the 002_untergeschoss.pdf file. I believe this file
does not need to marked as private.
The PDF file is invalid. The font descriptor for OfficinaSans-Book has /Subtype /CIDFontType2 i.e. declared CIDFont object but refers to an OpenType file that contains a simple CFF font. We cannot recover from this error. If I do: --- pdf_font.ps.old 2008-03-25 11:23:15.000000000 -0500 +++ pdf_font.ps 2008-03-25 21:58:38.000000000 -0500 @@ -1432,7 +1432,7 @@ /MMType1 //adjustfont /TrueType //adjustfont /CIDFontType0 //adjustCIDType0 - /CIDFontType2 //adjustCIDType2 + /CIDFontType2 //adjustfont % //adjustCIDType2 .dicttomark readonly def % Bind a proc and define n names The simplified sample proceeds to completion but renders incorrectly. According to the PDF spec, the descendant font must be CIDFont, not a simple font. Passing to Alex who handles PDF interpreter. A second customer has reported the same problem; I've attached their test file. Created attachment 3901 [details]
12619.pdf
Created attachment 3904 [details]
experimental patch - uses wrong encoding
This patch creates a CIDFont resource from a simple font. It fixes the
PostScript error but uses wrong encoding - some of the characters may be
swapped or missing.
The correct fix should be a part of ReadData procedure and use CharString INDEX
for glyph numbers.
Created attachment 3948 [details]
patch
This patch appears to work.
Created attachment 3951 [details]
patch
PDF can use OpenType font with ordinary CFF data as a CIDFont. Such a font is
referenced by /CIDFontType2 and may have /CIDToGIDMap table. The following
changes have been done to support this usage.
- A flag that forces CIDFont generation was added to CFF font loader.
- When the flag is on, CFF font is converted to a Type 9 CIDFont.
- The FontSet resource is returned by the value from the font loader
because it can be of either Font or CIDFont type,
- Since CIDMap has no effect on CIDFont Type 9, CIDToGIDMap is interpreted
by PDF reader to modify GlyphDirectory to the same effect.
- Unused CIDMap is no longer generated for CIDFontType2 objects that are nor
TrueType CIDFont resources.
Regression testing shows no differences.
The last path is committed as a rev. 8646. |