nanosvg icon indicating copy to clipboard operation
nanosvg copied to clipboard

Bug: pathFlag is never set

Open scippie75 opened this issue 5 years ago • 0 comments

I am trying to add functionality to parse the <desc> element within a <path> element.

This made me find this bug: In nsvg__startElement, the pathFlag is tested to prevent handling nested paths. But this flag is never set anywhere in the code, it is only being reset in the nsvg__endElement function. I want to use the pathFlag to know whether the <desc> element is inside the path element.

I added p->pathFlag = 1; after this test.

EDIT: I just finished the implementation, it works on description on any shape, not only paths (so the pathFlag isn't used). If you are interested, I can share the code.

Another EDIT: I noticed that the contents of the SVG tags are html-encoded. The strings need to be converted back to a cstring or an UTF-8 string. I am now using a small decoding c/h api for it, but is this maybe something that should be added to nanosvg itself? (would be something like 400 lines of extra code, mostly because of the lookup table which could of course be compacted in less lines)

scippie75 avatar May 16 '19 08:05 scippie75