node-rsvg
node-rsvg copied to clipboard
Out of memory on transformed text
node-rsvg blows up with error: out of memory when text (or a group with text, etc.) is transformed.
rsvg-convert works just fine though!
Minimal test case:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="256" height="256">
<text transform="translate(10, 10)" x="0" y="0" font-size="7.5">Hello</text>
</svg>
@myfreeweb I think this is not just with the transform attribute, I get the error with a simple:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="256" height="256">
<text x="10" y="10">Anything</text>
</svg>
Digging through the C++ see if I can find anything obvious.
Update
So, it seems that Cairo is returning out of memory on the following assignment:
cairo_status_t status = cairo_status(cr);
https://github.com/walling/node-rsvg/blob/master/src/Rsvg.cc#L396
Same here. @waltfy Have you been able to go through this?
@raphdg No. Ended up giving up, as we had to move on. Would like to know where it ends up. Maybe I'll take a look at it over the weekend?
Has anyone made any progress on this? This effectively means I have to call out to rsvg-convert instead of using node-rsvg.
So, it seems that Cairo is returning out of memory on the following assignment:
FYI, from reading the Cairo API it looks like that function just reports pre-existing errors. So the out of memory error is occurring sometime before that call to cairo_status.
A fix here would also be a huge help to me.
any updates on this? I'm getting the following error on text values
Assertion failed: (CAIRO_REFERENCE_COUNT_HAS_REFERENCE (&cr->ref_count)), function cairo_destroy, file cairo.c, line 301.
The only text value which is being render is 0. Otherwise, any of the above mentioned examples return the above error
Looks like this is fixed in 2gis/node-rsvg which is, apparently, the official fork (it's listed as the website on npm).
Does anyone have a fix for this. @myfreeweb the fork also does not fix this issue. I just tried it and run into the same issue.
I also have a problem with this with the following SVG:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns="http://www.w3.org/2000/svg" pointer-events="none" width="50" height="50" style="width: 50px; height: 50px; background-color: #2196F3;">
<text text-anchor="middle" y="50%" x="50%" dy="0.36em" pointer-events="auto" fill="#ffffff" font-family="Helvetica, Arial, Lucida Grande, sans-serif" style="font-weight: 400; font-size: 28px;">
AD
</text>
</svg>
I reported it in 2gis repository: https://github.com/2gis/node-rsvg/issues/7