JuliaGraphics / Luxor.jl

Simple drawings using vector graphics; Cairo "for tourists!"

Home Page:http://juliagraphics.github.io/Luxor.jl/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Parsing some largish svgs currently crash

hustf opened this issue · comments

commented

Originally posted by @hustf in #150 (comment)_

From 'adaptive_scaling.jl': 115, linked above:

    if endswith(filename, ".svg")
        # Ref. https://github.com/lobingera/Rsvg.jl/issues/26 - the fix seems to be 
        # implemented for large strings, but not for reading directly from file.
        st = read(filename, String);
        rimg = readsvg(st)
        # The following line failed for a large file. The smallest file with failure was 9801Kb.
        #rimg1 = readsvg(filename) 

With the fix above, we can work with extremely large svg files. I believe a similar fix applies to 'Luxor/images/_readsvgfile(fname).

Not sure what you mean here. Is there a fix for some problem that should be a PR to Luxor.jl?

commented

Sorry to have been unclear. Yes, I still believe there is an issue with reading largish svg files which can be fixed by reading the files as string first.

I have opened a fork and am trying to reproduce this parsing error (which of course was persistent a couple days ago).

However, the file size of the svg file is not the problem in itself. I don't know so far what is (or was).

commented

I have a halfway explanation now. We don't need to change anything in Luxor.
Here's the gist:
When we parse an svg file using readsvg(filename) and readsvg(string_contents_of_filename), it seems we are using a less lenient parser.

While testing the current master, I triggered a bug in the fix. The file was not acceptable to the less lenient parser. The best way forward is fixing the bug. I'm putting the details in #150.

commented

Resolved in master. Issue should be closed. If anything happens it's better to create new issues. The existing issues are getting cluttered a bit.