GNOME Bugzilla – Bug 401115
RSVG throws away meaningful nodes
Last modified: 2007-07-27 11:51:09 UTC
Please describe the problem: I have an SVG file (the file is generate by Illustrator) which has this block: <switch id="XMLID_8_" i:objectNS="&ns_flows;" i:objectType="pointText"> <foreignObject requiredExtensions="&ns_flows;" x="0" y="0" width="1" height="1" overflow="visible"> <flowDef xmlns="&ns_flows;"> <region textMatrix="1 0 0 1 0 0"> <path d="M270.405,1166.818"/> </region> <flow xmlns="&ns_flows;" font-family="'Courier'" font-size="12"> <p text-align="center" text-align-last="center"><span fill="#CA006C">information goes here and here. Event information goes here and here. </span></p> </flow> </flowDef> <x:targetRef xlink:href="#XMLID_78_"/> </foreignObject> <text id="XMLID_78_" transform="matrix(1 0 0 1 75.7197 1166.8179)" fill="#CA006C" font-family="'Courier'" font-size="12">information goes here and here. Event information goes here and here. </text> </switch> But the text never shows up when I try to convert it to PDF or PNG, I know that librsvg use freetype libs. I know that the "foreignObject" tag is setup for Illustrator but the "text" tab should work. Steps to reproduce: 1. SVG file with text inside. 2. Convert it to PDF or PNG using rsvg-convert. Actual results: The text on the PDF or the PNG file never shows up. Expected results: Show text on the final file, PDF or PNG file. Does this happen every time? Yes. Other information:
Please attach the whole SVG file. Thanks.
Created attachment 81294 [details] SVG file with variables and text there. SVG file with variables and text there.
I remove the "foreignObject" tags from the svg file and now rsvg-convert can render the "text" tag, I mean, I can see now the text :)
As far as I can tell, what's happening here is as follows: The switch is looking for a true condition. RSVG is ignoring nodes that it doesn't know about, such as foreignObject. Something within the foreignObject is being recognized, though, and saved as the next node. And *that* tag evaluates to true. What I think we should do is: If we encounter an unrecognized tag, create a dummy "group" tag that accumulates all the stuff under it. Its draw function is a no-op. Its requiredExtensions should evaluate to false. This will cause us to skip unrecognized tags when rendering, but not when evaluating a conditional's truth. This may have some possibly unwanted side-effects, though. For example, a SVG 1.2 document may have a <flow> tag, which we could render some text contents from. With this proposal, we wouldn't render anything within the <flow>. This might be an ok idea anyway, since we wouldn't have rendered it properly in the first place.
(In reply to comment #4) > If we encounter an unrecognized tag, create a dummy "group" tag that > accumulates all the stuff under it. Its draw function is a no-op. Its > requiredExtensions should evaluate to false. Actually, maybe its drawing function could just call draw() on each of its children. This would allow <flow> to still work as it does today. I'm not sure that this is a good idea, though.
2007-07-20 Dom Lachowicz <domlachowicz@gmail.com> * rsvg-base.c: rsvg threw away nodes that it didn't understand, which caused things like <switch> not to work properly. Now, treat unknown nodes as groups (#401115)
I think i have the same problem: svg file, exported from Corel, is drawn black square instead of text, also inkscape shows this text correctly. I was tryed 2007-07-20 svn snapshot (rev 1128)
Please attach the SVG file and reopen the bug. Thanks.
Created attachment 92524 [details] test svg file this is test svg file. i test it with rsvg-view picture2.svg or rsvg-convert to pdf-file.
(In reply to comment #9) > Created an attachment (id=92524) [edit] > test svg file > > this is test svg file. > i test it with rsvg-view picture2.svg or rsvg-convert to pdf-file. > Your problem has nothing to do with this bug. librsvg doesn't support SVG 1.1's text flow elements. I'm going to open another bug an CC you.