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

Font rendering problem #1275

Open
antucg opened this issue Oct 10, 2018 · 5 comments
Open

Font rendering problem #1275

antucg opened this issue Oct 10, 2018 · 5 comments

Comments

@antucg
Copy link

antucg commented Oct 10, 2018

Hi I don't use node-canvas directly, but fabric.js instead. This framework uses node-canvas. I posted a problem in their github repo: fabricjs/fabric.js#5296.

Basically the problem is related to the different way a font is rendered in the frontend and backend.
This is the image I have in my browser (OSX, Chrome).

screenshot 2018-10-05 at 13 07 43

Black and purple text layers are touching the vertical lines. This is the image once it is rendered with node canvas (Docker, linux image).

d33311c0-c892-11e8-ae1c-972848442e62 3

As you can see, purple text doesn't touch lines. Black text's right edge doesn't touch either. I have been told that this is due to the way that text is measured in node-canvas. Is there any solution or anything I can do to improve this behaviour?

Thanks.

@zbjornson
Copy link
Collaborator

This is probably #331 (metrics are off). What does your code look like? Are you using .fillText(string, x, y, maxWidth) (with the maxWidth arg) to get that layout?

@antucg
Copy link
Author

antucg commented Oct 10, 2018

Yes, I think it is the same problem. I don't use node-canvas directly. It is all done through fabric.js. That other post was created by kangax, the developer that started (or collaborates with) fabric.js. So it seems to be a recurring issue. Any idea if this will be fixed?

Thanks.

@asturur
Copy link
Contributor

asturur commented Oct 13, 2018

i wish we could identify a recurring pattern of metrics differences and counter fix them

@zbjornson
Copy link
Collaborator

@asturur do you know what Canvas code is running within fabric.js for this case? A simple repro would be useful.

@asturur
Copy link
Contributor

asturur commented Oct 14, 2018

For this particular case not ( author ahould disclose it ).
But fabricjs also run on 1.x since uses node canvas through jsdom.

i can try to reproduce failing code snippets of text, i have seen many

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

3 participants