You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Eric Astor <er...@gmail.com> on 2010/08/09 00:27:59 UTC
JSVGCanvas Problems - Rendering and Writing
Hi all,
I'm a developer on the Anathema project, where we use Batik to create
and display a directed graph (representing dependencies in the Exalted
game system). It's been great to us, mostly, but we've recently
discovered a pair of odd problems:
First, if we use DOMUtilities to write out the Document from our
canvas, we get a duplicate xmlns attribute in the resulting SVG file,
causing every viewer I've tried to refuse to render it. This is only a
minor inconvenience, but seems like a real bug. I've only observed the
problem under Windows 7 64-bit, but I haven't checked under other
operating systems yet. We're using the Batik 1.7 libraries.
Second, and much more severe for our purposes: JSVGCanvas seems to
differ from our intentions (and both Firefox and Chrome) in rendering
multiple <tspan>'s inside a <text> element with the
text-anchor="middle" property. When we use either our own Canvas or
Squiggle, all but the last <tspan> render their content as if they had
text-anchor="start" - the last one renders 'correctly', with text
anchored at its middle. This behavior repeats on both Windows XP
32-bit and Windows 7 64-bit. Strangely enough, this gets different
behavior on Linux... On Linux (Ubuntu 10.04, to be specific), all
<tspan>'s in such a situation render correctly.
Any thoughts, or suggestions as to possible workarounds for the second
problem? This is a serious problem for us, as we really need to be
able to control the alignment of the text we word-wrap.
Here's a sample SVG file where you can see the difference in
rendering. The only edit I've made to it is to remove the duplicate
xmlns attribute, so it can render successfully.
Thanks,
- Eric Astor
Re: JSVGCanvas Problems - Rendering and Writing
Posted by Martin Jacobson <ja...@gmail.com>.
Oops!
Well, to make amends, I just tested them against squiggle (batik 1.7)
and both work properly there, too.
Martin
On 10 August 2010 18:32, Eric Astor <er...@gmail.com> wrote:
> Martin,
>
> I'm afraid you misunderstood - the error does not occur in Firefox or
> Safari, but only when the SVG is loaded into a JSVGCanvas. For instance,
> load the SVG using Squiggle (the Batik SVG browser).
>
> - Eric
>
> On Aug 10, 2010 9:42 AM, "Martin Jacobson" <ja...@gmail.com>
> wrote:
>
> I tested both versions of the SVG on Firefox 3.6.8 and Safari 5.0.1 on
> Mac OS X 10.6 (Snow Leopard) - both are rendered correctly by both
> browsers so this may be a Windows-only issue.
>
> HTH
> Martin
>
> 2010/8/10 Helder Magalhães <he...@gmail.com>:
>
>> Hi Eric,
>>
>>
>>> First, if we use DOMUtilities to write out the Document from our
>>> canvas, we get...
>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
>> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>>
>
>
>
> --
> From my MacBook Pro
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>
>
--
>From my MacBook Pro
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
Re: JSVGCanvas Problems - Rendering and Writing
Posted by Eric Astor <er...@gmail.com>.
Martin,
I'm afraid you misunderstood - the error does not occur in Firefox or
Safari, but only when the SVG is loaded into a JSVGCanvas. For instance,
load the SVG using Squiggle (the Batik SVG browser).
- Eric
On Aug 10, 2010 9:42 AM, "Martin Jacobson" <ja...@gmail.com>
wrote:
I tested both versions of the SVG on Firefox 3.6.8 and Safari 5.0.1 on
Mac OS X 10.6 (Snow Leopard) - both are rendered correctly by both
browsers so this may be a Windows-only issue.
HTH
Martin
2010/8/10 Helder Magalhães <he...@gmail.com>:
> Hi Eric,
>
>
>> First, if we use DOMUtilities to write out the Document from our
>> canvas, we get...
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>
--
>From my MacBook Pro
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
Re: JSVGCanvas Problems - Rendering and Writing
Posted by Martin Jacobson <ja...@gmail.com>.
I tested both versions of the SVG on Firefox 3.6.8 and Safari 5.0.1 on
Mac OS X 10.6 (Snow Leopard) - both are rendered correctly by both
browsers so this may be a Windows-only issue.
HTH
Martin
2010/8/10 Helder Magalhães <he...@gmail.com>:
> Hi Eric,
>
>
>> First, if we use DOMUtilities to write out the Document from our
>> canvas, we get a duplicate xmlns attribute in the resulting SVG file,
>> causing every viewer I've tried to refuse to render it. This is only a
>> minor inconvenience, but seems like a real bug. I've only observed the
>> problem under Windows 7 64-bit, but I haven't checked under other
>> operating systems yet. We're using the Batik 1.7 libraries.
>
> Weird. When you mean duplicate, to which one are you referring, the
> one for the SVG namespace? Please paste a short snippet containing the
> duplicate attribute. Are you able to check if this still reproduces
> using Batik 1.8pre? There are (slightly outdated) nightly builds [1],
> handy when no build environment is available.
>
>
>> Second, and much more severe for our purposes: JSVGCanvas seems to
>> differ from our intentions (and both Firefox and Chrome) in rendering
>> multiple <tspan>'s inside a <text> element with the
>> text-anchor="middle" property. When we use either our own Canvas or
>> Squiggle, all but the last <tspan> render their content as if they had
>> text-anchor="start" - the last one renders 'correctly', with text
>> anchored at its middle.
>
> I confirm that it appears to be buggy behavior and have reported bug
> XXXX [2]. Playing with the issue I found a workaround: you seem to
> have trailing space in all but the last <tspan> elements (within the
> several available <text> elements). If you trim that whitespace, the
> issue no longer reproduces. ;-)
>
> Note that Firebug also has a related bug [3] while dealing with
> text-anchor="end" which may also become handy if you are making
> further experiments with this. :-)
>
>
>> This behavior repeats on both Windows XP
>> 32-bit and Windows 7 64-bit. Strangely enough, this gets different
>> behavior on Linux... On Linux (Ubuntu 10.04, to be specific), all
>> <tspan>'s in such a situation render correctly.
>
> Again, weird. I've marked the bug as Windows-only, and I'm holding
> that someone can confirm this for MacOS as well.
>
>
>> Here's a sample SVG file where you can see the difference in
>> rendering. The only edit I've made to it is to remove the duplicate
>> xmlns attribute, so it can render successfully.
>
> I'm attaching the modified test case which no longer reproduces the
> issue. The only modification I made was replacing " </tspan>" with
> "</tspan>" (which effectively trims all the trailing spaces found in
> <tspan> elements).
>
>
>> Thanks,
>> - Eric Astor
>
> Hope this helps,
> Helder
>
>
> [1] http://mcc.id.au/batik-nightly/
> [2] https://issues.apache.org/bugzilla/show_bug.cgi?id=49736
> [3] https://bugzilla.mozilla.org/show_bug.cgi?id=503075
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>
--
>From my MacBook Pro
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
Re: JSVGCanvas Problems - Rendering and Writing
Posted by Helder Magalhães <he...@gmail.com>.
Hi Eric,
> First, if we use DOMUtilities to write out the Document from our
> canvas, we get a duplicate xmlns attribute in the resulting SVG file,
> causing every viewer I've tried to refuse to render it. This is only a
> minor inconvenience, but seems like a real bug. I've only observed the
> problem under Windows 7 64-bit, but I haven't checked under other
> operating systems yet. We're using the Batik 1.7 libraries.
Weird. When you mean duplicate, to which one are you referring, the
one for the SVG namespace? Please paste a short snippet containing the
duplicate attribute. Are you able to check if this still reproduces
using Batik 1.8pre? There are (slightly outdated) nightly builds [1],
handy when no build environment is available.
> Second, and much more severe for our purposes: JSVGCanvas seems to
> differ from our intentions (and both Firefox and Chrome) in rendering
> multiple <tspan>'s inside a <text> element with the
> text-anchor="middle" property. When we use either our own Canvas or
> Squiggle, all but the last <tspan> render their content as if they had
> text-anchor="start" - the last one renders 'correctly', with text
> anchored at its middle.
I confirm that it appears to be buggy behavior and have reported bug
XXXX [2]. Playing with the issue I found a workaround: you seem to
have trailing space in all but the last <tspan> elements (within the
several available <text> elements). If you trim that whitespace, the
issue no longer reproduces. ;-)
Note that Firebug also has a related bug [3] while dealing with
text-anchor="end" which may also become handy if you are making
further experiments with this. :-)
> This behavior repeats on both Windows XP
> 32-bit and Windows 7 64-bit. Strangely enough, this gets different
> behavior on Linux... On Linux (Ubuntu 10.04, to be specific), all
> <tspan>'s in such a situation render correctly.
Again, weird. I've marked the bug as Windows-only, and I'm holding
that someone can confirm this for MacOS as well.
> Here's a sample SVG file where you can see the difference in
> rendering. The only edit I've made to it is to remove the duplicate
> xmlns attribute, so it can render successfully.
I'm attaching the modified test case which no longer reproduces the
issue. The only modification I made was replacing " </tspan>" with
"</tspan>" (which effectively trims all the trailing spaces found in
<tspan> elements).
> Thanks,
> - Eric Astor
Hope this helps,
Helder
[1] http://mcc.id.au/batik-nightly/
[2] https://issues.apache.org/bugzilla/show_bug.cgi?id=49736
[3] https://bugzilla.mozilla.org/show_bug.cgi?id=503075