[ 
https://issues.apache.org/jira/browse/PDFBOX-5713?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17785805#comment-17785805
 ] 

Jaromír Dobrý edited comment on PDFBOX-5713 at 11/14/23 8:58 AM:
-----------------------------------------------------------------

Thank you for the PFB specification. I can make following fix:
 * Accept ascii segments (public) followed by binary ones (encrypted) and then 
possibly the trailer ascii and EOF.
 * The parser will combine the ascii segments into segment1 and all binary 
segments into segment2 the rest will be thrown away (as it already is now).
 * All other mixtures will result in an IOException (Incorrect record type - 
maybe better message about this being an unsupported font format rather than 
invalid).

I hope this will work practically for all the fonts and will not break any 
other functionality of fontbox.

EDIT: Looking at the changes in *.diff file, I've found that this is probably 
what exactly I've already sent...


was (Author: JIRAUSER283200):
Thank you for the PFB specification. I can make following fix:
 * Accept ascii segments (public) followed by binary ones (encrypted) and then 
possibly the trailer ascii and EOF.
 * The parser will combine the ascii segments into segment1 and all binary 
segments into segment2 the rest will be thrown away (as it already is now).
 * All other mixtures will result in an IOException (Incorrect record type - 
maybe better message about this being an unsupported font format rather than 
invalid).

I hope this will work practically for all the fonts and will not break any 
other functionality of fontbox.

> PfbParser fails to parse PFB font with multiple binary records.
> ---------------------------------------------------------------
>
>                 Key: PDFBOX-5713
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-5713
>             Project: PDFBox
>          Issue Type: Bug
>          Components: FontBox
>    Affects Versions: 3.0.0 PDFBox
>            Reporter: Jaromír Dobrý
>            Priority: Major
>         Attachments: 5040.Download_Fonts.pdf, DejaVuSerifCondensed.pfb, 
> PDFBOX-5713.diff, type1_embedded.pdf
>
>
> * The attached PFB font can be opened in FontForge but PfbParser in fontbox 
> fails to read it.
>  * The problem is that fontbox assumes there are three records (ascii, 
> binary, ascii) in the PFB file but the binary part is split into multiple 
> shorter chunks (i.e. ascii, binary, ..., binary, ascii).
>  * I didn't find that this is forbidden and according to FontForge behavior 
> it seems to be valid.
>  * The fix seems to be easy, it is probably sufficient to concatenate the 
> binary records together in PfbParser and the result will work correctly.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to