You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Tilman Hausherr (JIRA)" <ji...@apache.org> on 2013/10/08 19:06:43 UTC

[jira] [Updated] (PDFBOX-1742) type1CFont font with null encoding

     [ https://issues.apache.org/jira/browse/PDFBOX-1742?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tilman Hausherr updated PDFBOX-1742:
------------------------------------

    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):

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

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

  was:
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):

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

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


> type1CFont font with null encoding
> ----------------------------------
>
>                 Key: PDFBOX-1742
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-1742
>             Project: PDFBox
>          Issue Type: Bug
>          Components: PDModel
>    Affects Versions: 1.8.3, 2.0.0
>            Reporter: Tilman Hausherr
>
> 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):
> {code}
> if (type1CFont.getFontEncoding() == null && getFontEncoding() != null) //TH
> {
>     LOG.info("Encoding of Type1CFont '" + type1CFont.getBaseFont() + "' is null, trying Type1Font encoding");
>     type1CFont.setFontEncoding(getFontEncoding());
>     }
> {code}
> Another improvement is the fat dash (at the beginning of "--use-merge-history" at the bottom of the mid column.



--
This message was sent by Atlassian JIRA
(v6.1#6144)