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

Unable to render font family #14330

Closed
rynangeles opened this issue Nov 30, 2021 · 3 comments
Closed

Unable to render font family #14330

rynangeles opened this issue Nov 30, 2021 · 3 comments

Comments

@rynangeles
Copy link

Attach (recommended) or Link to PDF file here:

Configuration:

  • Web browser and its version: Chrome
  • Operating system and its version: Windows 10
  • PDF.js version: 2.10.377
  • Is a browser extension: No

Steps to reproduce the problem:

  1. Updating project dependency [email protected] to 2.10.377
  2. Custom rendering of texts
  3. Make sure FontFaces are added to document
    Screenshot 2021-12-01 032105

What is the expected behavior? (add screenshot)
2.0.274 renders texts based on font-family styles
Screenshot 2021-11-25 062236

What went wrong? (add screenshot)
2.10.377 always use fallback font family
unnamed

Link to a viewer (if hosted on a site other than mozilla.github.io/pdf.js or as Firefox/Chrome extension):

@Snuffleupagus
Copy link
Collaborator

Attach (recommended) or Link to PDF file here:

This part of the ISSUE_TEMPLATE is always required in order for any issue to be actionable.

Steps to reproduce the problem:
1. Updating project dependency [email protected] to 2.10.377
2. Custom rendering of texts
3. Make sure FontFaces are added to document

While it's somewhat difficult to tell from the description, it sounds like this is maybe related to a custom implementation; hence please see https://github.com/mozilla/pdf.js/blob/master/.github/CONTRIBUTING.md (emphasis mine):

If you are developing a custom solution, first check the examples at https://github.com/mozilla/pdf.js#learning and search existing issues. If this does not help, please prepare a short well-documented example that demonstrates the problem and make it accessible online on your website, JS Bin, GitHub, etc. before opening a new issue or contacting us in the Matrix room -- keep in mind that just code snippets won't help us troubleshoot the problem.

@Snuffleupagus
Copy link
Collaborator

Updating project dependency [email protected] to 2.10.377

Please note that it's also quite difficult to assist with an upgrade from a PDF.js version that's almost four years old, and that 2.0.274 was also never an official release.

Given the lack of details it's difficult to tell, but if I were to guess you might have been utilizing the fonts (as parsed by the PDF.js library) in a non-intended and thus unsupported way. Please keep in mind that rendering and text-extraction uses different code-paths in PDF documents, and we've never supported using the font-files themselves for e.g. text-selection purposes.
It's possible that e.g. the changes in PR #9340 could be relevant for the issue you're having, but please note that as mentioned above it's unfortunately quite possible that you were doing something that neither is (nor was) officially supported.

All-in-all, closing as INCOMPLETE for now since we cannot help given the currently provided information.

@rynangeles
Copy link
Author

@Snuffleupagus sorry for the incomplete details of my issue. Basically, I was planning to update my project dependencies.
Application: https://typescript-35ttx9.stackblitz.io/
Code: https://stackblitz.com/edit/typescript-35ttx9?file=index.html
this is the actual code I use to render the PDF and the custom text layers.

In 2.0.274 I was able to display fontFaces of each text layer by just adding the textItem.fontName to its font-family rule in styles (as shown in my initial screenshots). e.g. font-family: g_d0_f1, sans-serif;. But in 2.10.377 its not rendering the fontFace.

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

2 participants