After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 401115 - RSVG throws away meaningful nodes
RSVG throws away meaningful nodes
Status: RESOLVED FIXED
Product: librsvg
Classification: Core
Component: general
2.16.x
Other All
: Normal normal
: ---
Assigned To: librsvg maintainers
librsvg maintainers
Depends on:
Blocks:
 
 
Reported: 2007-01-26 19:56 UTC by Juan Felipe Alvarez Saldarriaga
Modified: 2007-07-27 11:51 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
SVG file with variables and text there. (5.47 KB, application/octet-stream)
2007-01-26 21:02 UTC, Juan Felipe Alvarez Saldarriaga
Details
test svg file (75.75 KB, application/octet-stream)
2007-07-27 06:24 UTC, Eugene V. Horohorin
Details

Description Juan Felipe Alvarez Saldarriaga 2007-01-26 19:56:26 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:
Comment 1 Dominic Lachowicz 2007-01-26 20:01:06 UTC
Please attach the whole SVG file. Thanks.
Comment 2 Juan Felipe Alvarez Saldarriaga 2007-01-26 21:02:45 UTC
Created attachment 81294 [details]
SVG file with variables and text there.

SVG file with variables and text there.
Comment 3 Juan Felipe Alvarez Saldarriaga 2007-01-26 21:35:19 UTC
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 :)
Comment 4 Dominic Lachowicz 2007-01-26 21:53:55 UTC
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.
Comment 5 Dominic Lachowicz 2007-01-26 21:56:44 UTC
(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.
Comment 6 Dominic Lachowicz 2007-07-20 17:04:19 UTC
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)
Comment 7 Eugene V. Horohorin 2007-07-26 14:06:15 UTC
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)
Comment 8 Dominic Lachowicz 2007-07-26 14:11:26 UTC
Please attach the SVG file and reopen the bug. Thanks.
Comment 9 Eugene V. Horohorin 2007-07-27 06:24:31 UTC
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.
Comment 10 Dominic Lachowicz 2007-07-27 11:51:09 UTC
(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.