[prev in list] [next in list] [prev in thread] [next in thread]
List: batik-users
Subject: RE: textpath <path> clone affects text positioning?
From: "Nirmesh Desai" <ndesai () autonomy ! com>
Date: 2008-08-20 17:48:43
Message-ID: 3164730AF5D9B24B9E71427630B81B778E2242 () sd-ex1 ! verity ! com
[Download RAW message or body]
Thanks Thomas,
That worked perfectly. I had tried NS methods, but must have been careless somewhere.
This is great group for a cool tech..!
BR,
Nirmesh
________________________________
From: thomas.deweese@kodak.com [mailto:thomas.deweese@kodak.com]
Sent: Wednesday, August 20, 2008 3:22 AM
To: batik-users@xmlgraphics.apache.org
Cc: batik-users@xmlgraphics.apache.org
Subject: RE: textpath <path> clone affects text positioning?
Hi Nirmesh,
"Nirmesh Desai" <ndesai@autonomy.com> wrote on 08/19/2008 02:06:47 PM:
> //use textpath found through new id
> itemLabelTextPath.setAttribute('xlink:href','#'+textPathDefId);
This isn't correct. You must use the namespace aware
version of the DOM API's:
itemLabelTextPath.setAttributeNS
("http://www.w3.org/1999/xlink",
'xlink:href','#'+textPathDefId);
> textpathDef.setAttribute('id',textPathDefId);
> textpathDef.setAttribute('d',new_textpath);
Technically all your other setAttribute calls should look like
textpathDef.setAttributeNS(null, 'id',textPathDefId);
textpathDef.setAttributeNS(null, 'd',new_textpath);
I should also caution that if you try to create
element's yourself rather than cloning them you must
use the createElementNS methods rather than createElement.
> -----Original Message-----
> From: Helder Magalhães [mailto:helder.magalhaes@gmail.com]
> Sent: Tuesday, August 19, 2008 7:15 AM
> To: batik-users@xmlgraphics.apache.org
> Subject: Re: textpath <path> clone affects text positioning?
>
> > FireFox and Renesis player seem to put the text in correct place, however
> > batik svg viewer seems to somehow also use the 'd' defined in the template
> > from where I clone the <path> element so the text keeps changing whenever I
> > change the 'd' value in the 'template' <path>.
> >
> > I need to try to make the svg behave same in applet and the browsers.
>
> As always, creating and attaching a reduced test case [1] to the
> message may help receiving more and more valuable feedback. (For this
> case, apparently a single SVG file containing a script snippet and
> target path elements will do the trick.)
>
> Just a though: are you deep cloning the element (i.e.,
> "cloneNode(true)" [2])?. If not, then it is Firefox and Renesis who
> may be suffering from issues, as non-deep copies of DOM subtrees
> should act as "use" elements, that is, when you manipulate a non-deep
> cloned element, the referenced element is the one who is actually
> changed.
>
> Hope this helps,
>
> Helder Magalhães
>
> [1] http://webkit.org/quality/reduction.html
> [2] http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-3A0ED0A4
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>
[Attachment #3 (text/html)]
<html xmlns:v="urn:schemas-microsoft-com:vml" \
xmlns:o="urn:schemas-microsoft-com:office:office" \
xmlns:w="urn:schemas-microsoft-com:office:word" \
xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
{font-family:sans-serif;
panose-1:0 0 0 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman";}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{color:purple;
text-decoration:underline;}
tt
{font-family:"Courier New";}
span.EmailStyle18
{mso-style-type:personal-reply;
font-family:Arial;
color:navy;}
@page Section1
{size:8.5in 11.0in;
margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
{page:Section1;}
-->
</style>
</head>
<body lang=EN-US link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Thanks Thomas,<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>That worked perfectly. I had tried NS
methods, but must have been careless somewhere.<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>This is great group for a cool \
tech..!<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>BR,<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Nirmesh<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<div>
<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>
<hr size=2 width="100%" align=center tabindex=-1>
</span></font></div>
<p class=MsoNormal><b><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>From:</span></font></b><font size=2
face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>
thomas.deweese@kodak.com [mailto:thomas.deweese@kodak.com] <br>
<b><span style='font-weight:bold'>Sent:</span></b> Wednesday, August 20, 2008
3:22 AM<br>
<b><span style='font-weight:bold'>To:</span></b>
batik-users@xmlgraphics.apache.org<br>
<b><span style='font-weight:bold'>Cc:</span></b>
batik-users@xmlgraphics.apache.org<br>
<b><span style='font-weight:bold'>Subject:</span></b> RE: textpath <path>
clone affects text positioning?</span></font><o:p></o:p></p>
</div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><br>
</span></font><font size=2 face=sans-serif><span style='font-size:10.0pt;
font-family:sans-serif'>Hi Nirmesh,<br>
</span></font><br>
<tt><font size=2 face="Courier New"><span style='font-size:10.0pt'>"Nirmesh
Desai" <ndesai@autonomy.com> wrote on 08/19/2008 02:06:47 \
PM:</span></font></tt><font size=2 face="Courier New"><span \
style='font-size:10.0pt;font-family:"Courier New"'><br> <br>
<tt><font face="Courier New">> //use textpath found through new \
id</font></tt><br> <tt><font face="Courier New">> \
itemLabelTextPath.setAttribute('xlink:href','#'+textPathDefId);</font></tt><br> \
</span></font><br> <tt><font size=2 face="Courier New"><span \
style='font-size:10.0pt'> This isn't correct. You must use the \
namespace aware</span></font></tt> <br>
<tt><font size=2 face="Courier New"><span style='font-size:10.0pt'>version of
the DOM API's:</span></font></tt> <br>
<tt><font size=2 face="Courier New"><span style='font-size:10.0pt'>
itemLabelTextPath.setAttributeNS</span></font></tt> <br>
<tt><font size=2 face="Courier New"><span style='font-size:10.0pt'>
("http://www.w3.org/1999/xlink", \
</span></font></tt><br> <tt><font size=2 face="Courier New"><span \
style='font-size:10.0pt'> \
'xlink:href','#'+textPathDefId);</span></font></tt><font size=2 face="Courier \
New"><span style='font-size:10.0pt;font-family:"Courier New"'><br> </span></font><br>
<tt><font size=2 face="Courier New"><span style='font-size:10.0pt'>>
textpathDef.setAttribute('id',textPathDefId);</span></font></tt><font size=2
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'><br>
<tt><font face="Courier New">>
textpathDef.setAttribute('d',new_textpath);</font></tt><br>
</span></font><br>
<tt><font size=2 face="Courier New"><span style='font-size:10.0pt'>
Technically all your other setAttribute calls should look \
like</span></font></tt> <br>
<br>
<tt><font size=2 face="Courier New"><span style='font-size:10.0pt'>
textpathDef.setAttributeNS(null, 'id',textPathDefId);</span></font></tt><font
size=2 face="Courier New"><span style='font-size:10.0pt;font-family:"Courier \
New"'><br> <tt><font face="Courier New"> textpathDef.setAttributeNS(null,
'd',new_textpath);</font></tt><br>
</span></font><br>
<tt><font size=2 face="Courier New"><span style='font-size:10.0pt'> I
should also caution that if you try to create</span></font></tt> <br>
<tt><font size=2 face="Courier New"><span style='font-size:10.0pt'>element's
yourself rather than cloning them you must</span></font></tt> <br>
<tt><font size=2 face="Courier New"><span style='font-size:10.0pt'>use the
createElementNS methods rather than createElement.</span></font></tt> <br>
<br>
<br>
<tt><font size=2 face="Courier New"><span style='font-size:10.0pt'>>
-----Original Message-----</span></font></tt><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'><br>
<tt><font face="Courier New">> From: Helder Magalhães
[mailto:helder.magalhaes@gmail.com] </font></tt><br>
<tt><font face="Courier New">> Sent: Tuesday, August 19, 2008 7:15 \
AM</font></tt><br> <tt><font face="Courier New">> To: \
batik-users@xmlgraphics.apache.org</font></tt><br> <tt><font face="Courier New">> \
Subject: Re: textpath <path> clone affects text positioning?</font></tt><br>
<tt><font face="Courier New">> </font></tt><br>
<tt><font face="Courier New">> > FireFox and Renesis player seem to put
the text in correct place, however</font></tt><br>
<tt><font face="Courier New">> > batik svg viewer seems to somehow also
use the 'd' defined in the template</font></tt><br>
<tt><font face="Courier New">> > from where I clone the <path>
element so the text keeps changing whenever I</font></tt><br>
<tt><font face="Courier New">> > change the 'd' value in the 'template'
<path>.</font></tt><br>
<tt><font face="Courier New">> ></font></tt><br>
<tt><font face="Courier New">> > I need to try to make the svg behave
same in applet and the browsers.</font></tt><br>
<tt><font face="Courier New">> </font></tt><br>
<tt><font face="Courier New">> As always, creating and attaching a reduced
test case [1] to the</font></tt><br>
<tt><font face="Courier New">> message may help receiving more and more
valuable feedback. (For this</font></tt><br>
<tt><font face="Courier New">> case, apparently a single SVG file containing
a script snippet and</font></tt><br>
<tt><font face="Courier New">> target path elements will do the \
trick.)</font></tt><br> <tt><font face="Courier New">> </font></tt><br>
<tt><font face="Courier New">> Just a though: are you deep cloning the
element (i.e.,</font></tt><br>
<tt><font face="Courier New">> "cloneNode(true)" [2])?. If not,
then it is Firefox and Renesis who</font></tt><br>
<tt><font face="Courier New">> may be suffering from issues, as non-deep
copies of DOM subtrees</font></tt><br>
<tt><font face="Courier New">> should act as "use" elements, that
is, when you manipulate a non-deep</font></tt><br>
<tt><font face="Courier New">> cloned element, the referenced element is the
one who is actually</font></tt><br>
<tt><font face="Courier New">> changed.</font></tt><br>
<tt><font face="Courier New">> </font></tt><br>
<tt><font face="Courier New">> Hope this helps,</font></tt><br>
<tt><font face="Courier New">> </font></tt><br>
<tt><font face="Courier New">> Helder Magalhães</font></tt><br>
<tt><font face="Courier New">> </font></tt><br>
<tt><font face="Courier New">> [1] \
http://webkit.org/quality/reduction.html</font></tt><br> <tt><font face="Courier \
New">> [2] http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-3A0ED0A4</font></tt><br>
<tt><font face="Courier New">> </font></tt><br>
<tt><font face="Courier New">>
---------------------------------------------------------------------</font></tt><br>
<tt><font face="Courier New">> To unsubscribe, e-mail:
batik-users-unsubscribe@xmlgraphics.apache.org</font></tt><br>
<tt><font face="Courier New">> For additional commands, e-mail:
batik-users-help@xmlgraphics.apache.org</font></tt><br>
<tt><font face="Courier New">> </font></tt><br>
<tt><font face="Courier New">> </font></tt><br>
<tt><font face="Courier New">> </font></tt><br>
<tt><font face="Courier New">>
---------------------------------------------------------------------</font></tt><br>
<tt><font face="Courier New">> To unsubscribe, e-mail:
batik-users-unsubscribe@xmlgraphics.apache.org</font></tt><br>
<tt><font face="Courier New">> For additional commands, e-mail:
batik-users-help@xmlgraphics.apache.org</font></tt><br>
<tt><font face="Courier New">> </font></tt></span></font><o:p></o:p></p>
</div>
</body>
</html>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic