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 2021/05/13 04:23:00 UTC

[jira] [Comment Edited] (PDFBOX-5191) isEmbeddingPermitted() is too restrictive on TTFs with OS2 table versions 0-2

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

Tilman Hausherr edited comment on PDFBOX-5191 at 5/13/21, 4:22 AM:
-------------------------------------------------------------------

Thanks for your detailed text!

IMHO it's fine to add mockito. It's only for tests so no license problems.

Choices 2 or 3 are both fine. PDFBox 2 uses JUnit 4 and PDFBox 3 uses JUnit 5.

Re testing, I have the ARLRDBD.TTF font on my system, it probably came with MS Office.
{noformat}
30.05.2017  19:18            45.260 ARLRDBD.TTF
{noformat}
I modified {{testPDFBox3747}} in PDFontTest.java to use that font but didn't get an error with the existing code. Do you if you modify that test?

A possible explanation is that your font is a different one.


was (Author: tilman):
Thanks for your detailed text!

IMHO it's fine to add mockito. It's only for tests so no license problems.

2 or 3 are fine. 2 uses JUnit 4 and 3 uses JUnit 5.

Re testing, I have the ARLRDBD.TTF font on my system, it probably came with MS Office.
{noformat}
30.05.2017  19:18            45.260 ARLRDBD.TTF
{noformat}
I modified {{testPDFBox3747}} in PDFontTest.java to use that font but didn't get an error with the existing code. Do you if you modify that test?

A possible explanation is that your font is a different one.

> isEmbeddingPermitted() is too restrictive on TTFs with OS2 table versions 0-2
> -----------------------------------------------------------------------------
>
>                 Key: PDFBOX-5191
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-5191
>             Project: PDFBox
>          Issue Type: Bug
>          Components: PDModel
>    Affects Versions: 2.0.21, 3.0.0 PDFBox
>            Reporter: Larry Lynn
>            Priority: Major
>
> PDFBOX-4882 fixed a bug that made isEmbeddingPermitted() too permissive.  But it introduced a bug that made isEmbeddingPermitted() too restrictive for TTFs with OS2 table versions 0-2.
>  
> TTFs with OS2 table versions 0-2 can have multiple permission bits set.  According to the spec described in 
> [https://docs.microsoft.com/en-us/typography/opentype/spec/os2#fstype]
> "in the event that more than one of bits 0 to 3 are set in a given font, then the _least-restrictive permission indicated take precedence_."
> Unfortunately, the current code essentially makes the most restrictive permission take precedence.  This causes pdfbox to throw an error: 
> "This font does not permit embedding"
> when attempting to process fonts that worked fine in pdfbox v2.0.20 and lower



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org