node-rsvg icon indicating copy to clipboard operation
node-rsvg copied to clipboard

Out of memory on transformed text

Open valpackett opened this issue 11 years ago • 10 comments

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>

valpackett avatar May 30 '14 17:05 valpackett

@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

waltfy avatar Sep 04 '14 10:09 waltfy

Same here. @waltfy Have you been able to go through this?

raphdg avatar Oct 16 '14 14:10 raphdg

@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?

waltfy avatar Oct 22 '14 12:10 waltfy

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.

gabegorelick avatar Jan 13 '15 18:01 gabegorelick

A fix here would also be a huge help to me.

flahertyb avatar Apr 07 '15 22:04 flahertyb

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

azriel46d avatar Mar 18 '16 13:03 azriel46d

Looks like this is fixed in 2gis/node-rsvg which is, apparently, the official fork (it's listed as the website on npm).

valpackett avatar Apr 04 '16 13:04 valpackett

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.

ankurp avatar Oct 24 '16 20:10 ankurp

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>

mitar avatar Nov 14 '16 08:11 mitar

I reported it in 2gis repository: https://github.com/2gis/node-rsvg/issues/7

mitar avatar Nov 14 '16 09:11 mitar