Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with subsetting on OTF/CFF fonts #71

Open
zimmyg opened this issue Mar 15, 2018 · 4 comments
Open

Issue with subsetting on OTF/CFF fonts #71

zimmyg opened this issue Mar 15, 2018 · 4 comments

Comments

@zimmyg
Copy link

zimmyg commented Mar 15, 2018

I use OpenPDF in flying saucer to generate PDFs from HTML and I've run into a problem that I cannot use fonts such as NotoSansCJKjp (an OTF/CFF font) because CFF font subsetting does not work correctly.

The subsequent PDF output is broken in Acrobat, stating that the embedded font cannot be extracted. It does work in other readers, but I believe that is because they are more lenient than Acrobat on this issue, but unfortunately using another reader is not an option.

I created a fork of OpenPDF and turned off font subsetting entirely and the output works fine, but obviously this is also not an real solution, because these fonts can be quite large and this particular font results in a minimum PDF size of 12MB, so the problem compounds when using multiple fonts.

I inspected the PDF output with PDFBox's preflight and it errors with "Font DICT invalid without "Private" entry", which does indeed seem to point again to the subsetting being broken, not including a private section in each font dict, which would explain why Acrobat is falling over as well.

I did my best to try and fix this myself, but I've not made much headway so I thought I would reach out to the community and see if anyone has the necessary experience with CFF font subsetting in order to fix this issue.

Thanks

@szahariev
Copy link

I have a similar issue. I've created a PDF with Inter UI otf fonts and it looks perfect, but if you print it, it prints very badly (nothing could be read). If you however set subset to false it prints OK, but it is 4 times the original size.

@andreasrosdal
Copy link
Contributor

Pull-requests welcome

@codecracker2014
Copy link
Contributor

We have fixed substitution problems for TTF fonts by delegating font substitution to Apache FOP which very well supports advanced typography refer #297, #329. Same approach can be used for OTF, CFF and IVS fonts as well which is supported by FOP. Pull requests are welcome.

@asturio
Copy link
Member

asturio commented Feb 23, 2024

Can anybody verify it this issue is still unsolved. Maybe it's already fixed, and we forgot to close this issue.

Pull requests are still welcome ;-)

Some example code would be also nice, so we could check, if it already solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants