ICEpdf
  1. ICEpdf
  2. PDF-408

ArrayIndexOutOfBoundsException with PDF with embedded Chinese font

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.3.2
    • Fix Version/s: 4.3.3
    • Component/s: Core/Parsing
    • Labels:
      None
    • Environment:
      -

      Description

      The following exception is thrown when attempting to render the attached PDF with embedded Chinese fonts:

      WARNING: Error parsing hexadecimal characters.
      Mar 15, 2012 4:56:06 PM org.icepdf.core.pobjects.fonts.FontFactory createFontFile
      FINE: Could not create instance oof font file 0
      java.lang.reflect.InvocationTargetException
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
      at org.icepdf.core.pobjects.fonts.FontFactory.createFontFile(FontFactory.java:148)
      at org.icepdf.core.pobjects.fonts.FontDescriptor.init(FontDescriptor.java:290)
      at org.icepdf.core.pobjects.fonts.nfont.Font.init(Unknown Source)
      at org.icepdf.core.pobjects.fonts.nfont.Font.init(Unknown Source)
      at org.icepdf.core.pobjects.Resources.getFont(Resources.java:222)
      at org.icepdf.core.util.ContentParser.consume_Tf(ContentParser.java:2089)
      at org.icepdf.core.util.ContentParser.parseText(ContentParser.java:1074)
      at org.icepdf.core.util.ContentParser.parse(ContentParser.java:259)
      at org.icepdf.core.pobjects.Form.init(Form.java:202)
      at org.icepdf.core.util.ContentParser.consume_Do(ContentParser.java:1903)
      at org.icepdf.core.util.ContentParser.parse(ContentParser.java:373)
      at org.icepdf.core.pobjects.Page.init(Page.java:372)
      at org.icepdf.core.views.swing.PageViewComponentImpl$PageInitilizer.run(PageViewComponentImpl.java:1072)
      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:680)
      Caused by: java.lang.ArrayIndexOutOfBoundsException: 65662
      at org.icepdf.core.pobjects.fonts.nfont.NFontTrueType.getCmap(Unknown Source)
      at org.icepdf.core.pobjects.fonts.nfont.NFontTrueType.parse(Unknown Source)
      at org.icepdf.core.pobjects.fonts.nfont.g.<init>(Unknown Source)
      at org.icepdf.core.pobjects.fonts.nfont.NFontTrueType.<init>(Unknown Source)
      ... 20 more

        Activity

        Hide
        Patrick Corless added a comment -

        I'll try to sneak this one into 4.3.3.

        Show
        Patrick Corless added a comment - I'll try to sneak this one into 4.3.3.
        Hide
        Evgheni Sadovoi added a comment -

        Customer feedback:

        According to our investigation, if we do not embed the Chinese font in the PDF file and use the system font instead (provided that the font is installed in the system already), the Chinese font can be displayed correctly.
        This result leads us to the following request. In the future release, can the precedence of the font selection order be controlled by users (i.e. system font first then embedded font)?

        Show
        Evgheni Sadovoi added a comment - Customer feedback: According to our investigation, if we do not embed the Chinese font in the PDF file and use the system font instead (provided that the font is installed in the system already), the Chinese font can be displayed correctly. This result leads us to the following request. In the future release, can the precedence of the font selection order be controlled by users (i.e. system font first then embedded font)?
        Hide
        Patrick Corless added a comment -

        The embedded font file had an error where it reportedly contained more fonts then it actually did. I added a check that would let the parser recover and display the font and PDF correctly.

        Show
        Patrick Corless added a comment - The embedded font file had an error where it reportedly contained more fonts then it actually did. I added a check that would let the parser recover and display the font and PDF correctly.

          People

          • Assignee:
            Patrick Corless
            Reporter:
            Tyler Johnson
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: