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

Try to render fonts on canvas correctly #1

Open
Hikariii opened this issue Nov 30, 2017 · 4 comments
Open

Try to render fonts on canvas correctly #1

Hikariii opened this issue Nov 30, 2017 · 4 comments

Comments

@Hikariii
Copy link
Member

Hikariii commented Nov 30, 2017

See mozilla/pdf.js#7929.
Embedded fonts could not be rendered through node-canvas.

Now Canvas has https://github.com/Automattic/node-canvas#registerfont-for-bundled-fonts.
Try to use a pdf.js hook to register a font with Canvas and render it.

If this is implemented PDFJS.disableFontFace=true; can be set to false.

@swftvsn
Copy link

swftvsn commented Mar 27, 2018

Do you have any plans to implement this or can give any directions where to begin to look? Or how did you generally plan to make this work?

@swftvsn
Copy link

swftvsn commented Mar 27, 2018

If you could take a look at mozilla/pdf.js#7929 (comment) (and comments below) I would appreciate it.

@Hikariii
Copy link
Member Author

Hikariii commented Mar 28, 2018

@swftvsn Not sure how to approach this. This issue is not (yet) a priority for us, because we are fine with rendering fonts as images. It is not a priority for us right now, but to point you in a direction: I'm pretty sure you need the fonts installed on the machine running nodejs.

Looking at your Pango warning that may not be the case in your setup (just a guess):

(process:36223): Pango-WARNING **: 15:46:36.286: couldn't load font 
"ABBVIT+Impact,monospace Condensed Not-Rotated 16px", modified 
variant/weight/stretch as fallback, expect ugly output.

It's something I missed the last time trying.

Still, if you render the node-canvas as image (png/jpg) it may be enough to set disableFontFace=true and skip rendering fonts all together.

@swftvsn
Copy link

swftvsn commented Mar 28, 2018

@Hikariii Yep, we're running with disableFontFace=true but unfortunately a lot of PDFs fail to render for us, and we can't skip those.. We're hitting this issue: mozilla/pdf.js#4244

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

No branches or pull requests

2 participants