deeplook / svglib

Read SVG files and convert them to other formats.
GNU Lesser General Public License v3.0
311 stars 80 forks source link

converted characters flock #328

Open retsyo opened 2 years ago

retsyo commented 2 years ago

I installed latest svglib and reportlab-3.6.9-cp38-cp38-win_amd64.whl on python-3.8.1.amd64 on my windows 10 64 bits.

however the generated png and pdf is in a mess

the original svg and generated pdf/png is in the attached zip tmp.zip

from svglib.svglib import svg2rlg
from reportlab.graphics import renderPDF, renderPM

drawing = svg2rlg("tmp.svg")
renderPDF.drawToFile(drawing, "file.pdf")
renderPM.drawToFile(drawing, "tmp.png", fmt="PNG")
github-actions[bot] commented 2 years ago

Thank you for raising your first issue! Your help to improve svglib is much appreciated!

claudep commented 2 years ago

Your original svg looks weird, when opening it with inkscape, I'm only seeing a blank page.

retsyo commented 2 years ago

but all of Edge/Chrome/FireFox/CairoSVG can render it correctly

deeplook commented 2 years ago

FWIW, it looks ok in https://www.svgviewer.dev.

claudep commented 2 years ago

When debuging this issue, I find different issues. It looks like <symbol> handling is broken in several ways currently in svglib. I'll see if I can do something. I started in #329 by only rendering <symbol> when referenced, as the specs says (A [‘symbol’] element itself is not rendered.) It is not fixing this issue yet, as after that patch, your document will be blank.

claudep commented 2 years ago

330 was another issue hit by your file.

retsyo commented 2 years ago

no, if I use the lastet cloned svglib, my script in the beginning post can only produce blank PDF and PNG, in other words, there is no character in PDF and PNG