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

Text - Rendering differences when text justified with strikethrough #2449

Closed
inssein opened this issue Aug 26, 2015 · 7 comments
Closed

Text - Rendering differences when text justified with strikethrough #2449

inssein opened this issue Aug 26, 2015 · 7 comments

Comments

@inssein
Copy link
Contributor

inssein commented Aug 26, 2015

I am just rigorously testing my application for differences between client and server side rendering, and I came across one right now.

When rendered in the browser, it looks correct:
report-2

The same, when rendered in node-canvas:
report-1

I will be debugging this later on, but if anyone has any ideas on what it could be, any help would be appreciated.

@asturur
Copy link
Member

asturur commented May 2, 2016

Did you debug the cause?
This looks a justifed text, where we do not use spaces, rather we just advance the next word of the space needed to fill the row.
Then text decoration is just a fillRect.

So i'm amazed nodecanvas has problem with it.
Do you have some suggestion?

@inssein
Copy link
Contributor Author

inssein commented May 2, 2016

sorry @asturur haven't had a chance to work on this at all. Still one of the things I need to look into.

@asturur
Copy link
Member

asturur commented May 2, 2016

I'm not good with nodejs + fabric yet.
If you could share some code snippet to speed me up, i would be more than happy to start bugfixing.

I need a simple js file that contains:
requires, canvas setup, todataurl in png in same folder.
and that i can run with a simple "node file.js"

In the middle i will add the code i need to debug.

Or something that will start simple webserver that outputs the png in my broeser instead of putting in the folder.

If i have a tool like this i can start. I have so many issues to take care of that i always postpone node.

@inssein
Copy link
Contributor Author

inssein commented May 2, 2016

@asturur I have a simple web debugger, but it is unfortunately strongly tied to our application (we store information about shapes very differently for legacy reasons, etc).

Unfortunately its my last week at this job, and I too (like kagnax) am starting a new job elsewhere.

All that said, I will try to setup a small application for you based on JSON export that can re-create this experiment.

@inssein
Copy link
Contributor Author

inssein commented May 4, 2016

Hey @asturur, I cannot seem to replicate this in the Kitchensink (http://fabricjs.com/kitchensink). Text that has strike-through and is justified does not render the same in the kitchensink as it does in my application.

I have setup a small debug renderer you can use, the gist is available here:
https://gist.github.com/inssein/b95b1506f089301bcdf9f207dc05e2a6

It basically allows you to pass in JSON, and renders it. It needs some work (dynamic sizing, etc) but should be a good start. I use something similar for our internal application.

@inssein
Copy link
Contributor Author

inssein commented May 5, 2016

@asturur I am not sure if the Kitchensink version changed, but today the results are different.

Try the following JSON:

{"objects":[{"type":"textbox","originX":"left","originY":"top","left":112,"top":156,"width":427,"height":52.43,"fill":"#333","stroke":null,"strokeWidth":1,"strokeDashArray":null,"strokeLineCap":"butt","strokeLineJoin":"miter","strokeMiterLimit":10,"scaleX":1,"scaleY":1,"angle":0,"flipX":false,"flipY":false,"opacity":1,"shadow":null,"visible":true,"clipTo":null,"backgroundColor":"","fillRule":"nonzero","globalCompositeOperation":"source-over","transformMatrix":null,"skewX":0,"skewY":0,"text":"Hello World","fontSize":40,"fontWeight":"normal","fontFamily":"Helvetica","fontStyle":"","lineHeight":1.16,"textDecoration":" line-through","textAlign":"justify","textBackgroundColor":"","styles":{"0":{"1":{},"2":{},"3":{},"4":{},"5":{},"6":{},"7":{},"8":{},"9":{},"10":{},"11":{}}},"minWidth":20}],"background":""}

@asturur
Copy link
Member

asturur commented Mar 9, 2019

nodecanvas2 seems to solve this
close with 09811bd

@asturur asturur closed this as completed Mar 9, 2019
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