Details
-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 4.0.1
-
Fix Version/s: 4.1
-
Component/s: Font Engine
-
Labels:None
-
Environment:-
-
Workaround Exists:Yes
-
Workaround Description:Remove font engine.
Description
The font engine is causing an exception to be thrown and blank pages rendered when used with the attached 9252.pdf. Disabling the font engine allows the files to be displayed correctly. Here is the 4.0.1 Pro exception:
FINE: Error initializing Page.
java.lang.ClassCastException: org.icepdf.core.pobjects.Name cannot be cast to org.icepdf.core.pobjects.Stream
at org.icepdf.core.pobjects.fonts.nfont.Font.init(Unknown Source)
at org.icepdf.core.pobjects.Resources.getFont(Resources.java:234)
at org.icepdf.core.util.ContentParser.consume_Tf(ContentParser.java:2020)
at org.icepdf.core.util.ContentParser.parseText(ContentParser.java:1147)
at org.icepdf.core.util.ContentParser.parse(ContentParser.java:280)
at org.icepdf.core.pobjects.Page.init(Page.java:369)
at org.icepdf.core.views.swing.PageViewComponentImpl$PageInitilizer.run(PageViewComponentImpl.java:1088)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:637)
FINE: Error initializing Page.
java.lang.ClassCastException: org.icepdf.core.pobjects.Name cannot be cast to org.icepdf.core.pobjects.Stream
at org.icepdf.core.pobjects.fonts.nfont.Font.init(Unknown Source)
at org.icepdf.core.pobjects.Resources.getFont(Resources.java:234)
at org.icepdf.core.util.ContentParser.consume_Tf(ContentParser.java:2020)
at org.icepdf.core.util.ContentParser.parseText(ContentParser.java:1147)
at org.icepdf.core.util.ContentParser.parse(ContentParser.java:280)
at org.icepdf.core.pobjects.Page.init(Page.java:369)
at org.icepdf.core.views.swing.PageViewComponentImpl$PageInitilizer.run(PageViewComponentImpl.java:1088)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:637)
The cmap name issue is pretty easy to fix but isn't the root of the problem. The PDF uses a CID font that has identity-H encoding which we incorrectly handling. Once the cmap cast issue was correct the PDF showed but with incorrect text. I spent a lot of time tracing to try and figure out what the problem was and after a lot of false starts manged to figured out that we where incorrectly reversing the CIDToGIDMap which caused the cmaps to incorrectly display. I still can't find concrete rules in the spec as when to reverse the CIDToGIDMap entries but the currently logic seems to be working ok.