[
https://issues.apache.org/jira/browse/PDFBOX-3403?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15367994#comment-15367994
]
John Hewson commented on PDFBOX-3403:
-------------------------------------
{quote}Couldn't in that case an empty encoding serve the extra needs?{quote}
No because we're talking about a font's built-in encoding which can never be
null, or empty, or missing. It must be there. If it's somehow not then PDFBox
would substitute a valid font file in its place. So at this point in the code,
the built-in encoding must be *something*. Also, for symbolic fonts without a
valid BaseEncoding, this is the encoding which we're going to actually use to
read from that font - so empty is not a useful value, as it means we can't
decode any of that font's text.
{quote}Ah, indeed. I was misled by the JavaDocs of the three-argument
constructor which also mentions Type 3 fonts.{quote}
Yes we do overload the constructors, so Type 3 code does call this, but it's
handled as a special case, the rules that apply there don't apply to non-Type 3
fonts.
> IllegalArgumentException: Symbolic fonts must have a built-in encoding
> ----------------------------------------------------------------------
>
> Key: PDFBOX-3403
> URL: https://issues.apache.org/jira/browse/PDFBOX-3403
> Project: PDFBox
> Issue Type: Bug
> Components: PDModel
> Affects Versions: 2.0.2, 2.0.3, 2.1.0
> Reporter: Tilman Hausherr
> Assignee: John Hewson
> Fix For: 2.0.3, 2.1.0
>
> Attachments: PDFBOX-3403-XXX.pdf, PDFBOX-3403-YYY.pdf, PDFBOX-3403.pdf
>
>
> Happens with text extraction and rendering:
> {code}
> Exception in thread "main" java.lang.IllegalArgumentException: Symbolic fonts
> must have a built-in encoding
> at
> org.apache.pdfbox.pdmodel.font.encoding.DictionaryEncoding.<init>(DictionaryEncoding.java:113)
> at
> org.apache.pdfbox.pdmodel.font.PDSimpleFont.readEncoding(PDSimpleFont.java:126)
> at
> org.apache.pdfbox.pdmodel.font.PDType1CFont.<init>(PDType1CFont.java:131)
> at
> org.apache.pdfbox.pdmodel.font.PDFontFactory.createFont(PDFontFactory.java:60)
> at org.apache.pdfbox.pdmodel.PDResources.getFont(PDResources.java:123)
> at
> org.apache.pdfbox.contentstream.operator.text.SetFontAndSize.process(SetFontAndSize.java:60)
> at
> org.apache.pdfbox.contentstream.PDFStreamEngine.processOperator(PDFStreamEngine.java:829)
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]