Open matthewbillienyc opened 5 years ago
@LinusU and @zbjornson Thanks for fixing that issue with the resolution
. We ran across this breaking change as well in 2.1.0
and we're hoping one of you could help by taking a look. The repo we set up is pretty straightforward to show the breaking change.
I do think it has to do with these lines but I can't say why these lines would have broken it since it was a double
before when using ->NumberValue()
...
2.0.0-alpha.18
: https://github.com/Automattic/node-canvas/blob/586b395afb4a7/src/CanvasRenderingContext2d.cc#L2513-L2526
2.1.0
: https://github.com/Automattic/node-canvas/blob/v2.1.0/src/CanvasRenderingContext2d.cc#L2497-L2524
Tested locally using mentioned versions of prebuilt canvas and Node.js:
@zbjornson I'm still seeing this issue on the latest versions of node-canvas & Node.js. I put together another test repo (much credit to @matthewbillienyc!) that tests against various node-canvas and Node.js versions here: https://github.com/jls83/node_canvas_svg_2
@Hakerh400 @zbjornson @LinusU so update here. We actually ended up resolving this issue by building from source.
If anyone stumbles on this thread and wants a resolution (although I cannot exactly say "why") if you install via npm install --build-from-source
on Ubuntu that should do the trick!
Created this test app to demonstrate the issue: https://github.com/matthewbillienyc/node-canvas-svg-test/
Node Canvas SVG to PNG issue
So this repo is to show how between
node-canvas
versions2.0.0-alpha.181
and2.1.0
a bug with rendering SVG arcs was introduced.Environment Info
node-canvas 2.0.0-alpha.18
The png image that is created looks correct.
node-canvas 2.1.0
The png image that is created does not look correct.
SVG data
Here is an online SVG rendering of the SVG data below. The offending data is this:
A 10 10 0 1 1 16.499995000000418 10.49000000166666
. Specifically it looks like the10.49000000166666
in the arc path is what causes it to break.Why is it breaking? Great question!
I am not 100% sure. But we spent some time looking into by comparing all the commits between
2.0.0-alpha.18
and2.1.0
. You will see that it looks like this Pull Request (1288: Adapt to V8 7.0
) is the offending change. More specifically I believe it is these lines in CanvasRenderingContext2d.cc that caused the breaking of the arc path.