Uploaded image for project: 'PDFBox'
  1. PDFBox
  2. PDFBOX-5727

Font operation takes a long time with 3.0.1

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.30, 3.0.1 PDFBox
    • 2.0.31, 3.0.2 PDFBox, 4.0.0
    • None

    Description

      Kjetil Ødegaard on the users mailing list reported that the start of PDFBox takes a long time during font collection and that two .ttc fonts that fail are tried every time. He produced a stack trace of an exception that is caught:

      java.io.EOFException
      at
      org.apache.fontbox.ttf.TTFDataStream.readUnsignedShort(TTFDataStream.java:154)
      at
      org.apache.fontbox.ttf.TTFDataStream.readUnsignedShortArray(TTFDataStream.java:188)
      at
      org.apache.fontbox.ttf.GlyphSubstitutionTable.readMultipleSubstitutionSubtable(GlyphSubstitutionTable.java:412)
      at
      org.apache.fontbox.ttf.GlyphSubstitutionTable.readLookupSubtable(GlyphSubstitutionTable.java:263)
      at
      org.apache.fontbox.ttf.GlyphSubstitutionTable.readLookupTable(GlyphSubstitutionTable.java:313)
      at
      org.apache.fontbox.ttf.GlyphSubstitutionTable.readLookupList(GlyphSubstitutionTable.java:247)
      at
      org.apache.fontbox.ttf.GlyphSubstitutionTable.read(GlyphSubstitutionTable.java:102)
      at org.apache.fontbox.ttf.TrueTypeFont.readTable(TrueTypeFont.java:365)
      at org.apache.fontbox.ttf.TTFParser.parseTables(TTFParser.java:165)
      at org.apache.fontbox.ttf.TTFParser.parse(TTFParser.java:144)
      at
      org.apache.fontbox.ttf.TrueTypeCollection.getFontAtIndex(TrueTypeCollection.java:127)
      at
      org.apache.fontbox.ttf.TrueTypeCollection.processAllFonts(TrueTypeCollection.java:109)
      at
      org.apache.pdfbox.pdmodel.font.FileSystemFontProvider.addTrueTypeCollection(FileSystemFontProvider.java:665)
      at
      org.apache.pdfbox.pdmodel.font.FileSystemFontProvider.scanFonts(FileSystemFontProvider.java:396)
      at
      org.apache.pdfbox.pdmodel.font.FileSystemFontProvider.<init>(FileSystemFontProvider.java:367)
      at
      org.apache.pdfbox.pdmodel.font.FontMapperImpl$DefaultFontProvider.<clinit>(FontMapperImpl.java:139)
      at
      org.apache.pdfbox.pdmodel.font.FontMapperImpl.getProvider(FontMapperImpl.java:158)
      at
      org.apache.pdfbox.pdmodel.font.FontMapperImpl.findFont(FontMapperImpl.java:416)
      at
      org.apache.pdfbox.pdmodel.font.FontMapperImpl.findFontBoxFont(FontMapperImpl.java:379)
      at
      org.apache.pdfbox.pdmodel.font.FontMapperImpl.getFontBoxFont(FontMapperImpl.java:353)
      at org.apache.pdfbox.pdmodel.font.PDType1Font.<init>(PDType1Font.java:127)
      

      I have a theory why it happens, which is that addTrueTypeCollection() does not add the font as "skipexception" to the cache file because it's not done in the exception handler.

      Gili Tzabari suggested to use CRC32 instead of SHA512.

      Attachments

        Issue Links

          Activity

            People

              tilman Tilman Hausherr
              tilman Tilman Hausherr
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: