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

Adding Standard 14 Font Support - For Acroform use #11637

Closed
bpetty-formfast opened this issue Feb 27, 2020 · 5 comments
Closed

Adding Standard 14 Font Support - For Acroform use #11637

bpetty-formfast opened this issue Feb 27, 2020 · 5 comments

Comments

@bpetty-formfast
Copy link

The Issue:
Today Acroform text input elements are not being styled correctly in regard to font, font size, etc.
There are two issues there, one involving a half baked font reference issue where fontRefName is never being set. Even when implemented, there may never be a font reference. The second issue is that pdf.js does not have "Standard 14" font support that describes 14 fonts that acrobat reader instinctively knows about.

Questions:

  1. Would the project be interested if I submit a pull request adding support for these fonts? This would make acroform input look better until full font reference support is eventually added.
  2. If so, I have a basic implementation that works but it uses my own function for parsing DA for text annotations. I think the right way would be to use the EvaluatorPreprocessor, but being new to the codebase I am not sure exactly how to go about leveraging it, or if you would like any of this information exposed through your public api when someone uses pdfjs-dist to find all annotations, or if this should be used in a more general place. So basically I am asking if someone would provide some guidance on what you would like to see, if you would even find this useful in the first place.

Thanks!
image

@timvandermeij
Copy link
Contributor

There is some DA parsing in https://github.com/mozilla/pdf.js/pull/10122/files, but it was never finished.

I think we don't have the 14 standard fonts because of licensing issues, but perhaps @Snuffleupagus can chime in on that part?

@bpetty-formfast
Copy link
Author

@timvandermeij, thanks for the pull reference.

My thought was to have a small array of these fonts with their properties. Something like this:
HeBO: { name: 'Helvitica-BoldOblique', root: 'Helvitica', bold: true, italic: true },

We could parse the DA to get the font-code and size, use the code to look up the actual font and font characteristics, and then do the equivalent of "_setTextStyle" in annotation_layer.js.

Because this is strictly working in the display within the browser, the fonts do not necessarily need to be shipped (I assume that was the licensing issue). All we would be doing is simply providing browser hints to what we are looking for. I can see this being useful until the fontRefName issue for acroforms is resolved, and for PDFs that do not actually embed these fonts at all.

@brendandahl
Copy link
Contributor

I think we don't have the 14 standard fonts because of licensing issues, but perhaps @Snuffleupagus can chime in on that part?

I think we could use the fonts in pdfium since the project is also apache 2.0.

@sayo96
Copy link

sayo96 commented Dec 6, 2020

@brendandahl @timvandermeij What is the current status of this issue? If possible please let me know when you guys will release a update with fix in pdf-distnpm package as well

@Snuffleupagus
Copy link
Collaborator

Duplicate of #4244

@Snuffleupagus Snuffleupagus marked this as a duplicate of #4244 Jun 8, 2021
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