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

type1CFont font with null encoding

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.8.3, 2.0.0
    • 2.0.0
    • PDModel
    • None

    Description

      The file from PDFBOX-427 does not display the bullets (near "diff" in the right column)

      Through debugging I found out:

      The glyph code to be rendered is 183. That code doesn't exist in the font, however a code 116 exists, and it came from an "sid" code (CFFGlyph2D constructor). A mapping of the name ("bullet") through the nameToCode table isn't done because encoding is null.

      PDSimpleFont.determineEncoding() sets a null encoding
      PDType1Font.determineEncoding() sets a "good" encoding based on getAFM()
      (both called from constructor)
      getAFM() gets an encoding table that includes codetoname/nametocode 183 <=> bullet

      Later, due to having a FontFile3, a new type1CFont is created with the external file, but with no encoding.

      The following change in PDType1Font.java works for me (first line is the existing line):

      if (type1CFont.getFontEncoding() == null && getFontEncoding() != null) //TH
      {
          LOG.info("Encoding of Type1CFont '" + type1CFont.getBaseFont() + "' is null, trying Type1Font encoding");
          type1CFont.setFontEncoding(getFontEncoding());
          }
      

      Another improvement is the fat dash (at the beginning of "--use-merge-history" at the bottom of the mid column.

      Attachments

        1. PDFBOX-427-bullets.pdf
          60 kB
          Tilman Hausherr
        2. PDFBOX-427-bullets-baad.pdf-1.png
          1.13 MB
          Tilman Hausherr
        3. PDFBOX-427-bullets-good.pdf-1.png
          1.13 MB
          Tilman Hausherr

        Issue Links

          Activity

            People

              lehmi Andreas Lehmkühler
              tilman Tilman Hausherr
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: