[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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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 &lt;path&gt;
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>&nbsp;</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'>&quot;Nirmesh
Desai&quot; &lt;ndesai@autonomy.com&gt; 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">&gt; &nbsp; //use textpath found through new \
id</font></tt><br> <tt><font face="Courier New">&gt; &nbsp; \
itemLabelTextPath.setAttribute('xlink:href','#'+textPathDefId);</font></tt><br> \
</span></font><br> <tt><font size=2 face="Courier New"><span \
style='font-size:10.0pt'>&nbsp; &nbsp;This isn't correct. &nbsp;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'>&nbsp;
&nbsp; itemLabelTextPath.setAttributeNS</span></font></tt> <br>
<tt><font size=2 face="Courier New"><span style='font-size:10.0pt'>&nbsp;
&nbsp; &nbsp; &nbsp; (&quot;http://www.w3.org/1999/xlink&quot;, \
</span></font></tt><br> <tt><font size=2 face="Courier New"><span \
style='font-size:10.0pt'>&nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp;'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'>&gt; &nbsp;
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">&gt; &nbsp;
textpathDef.setAttribute('d',new_textpath);</font></tt><br>
</span></font><br>
<tt><font size=2 face="Courier New"><span style='font-size:10.0pt'>&nbsp;
&nbsp;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'>&nbsp;
&nbsp; 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">&nbsp; &nbsp;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'>&nbsp; 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'>&gt;
-----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">&gt; From: Helder Magalhães
[mailto:helder.magalhaes@gmail.com] </font></tt><br>
<tt><font face="Courier New">&gt; Sent: Tuesday, August 19, 2008 7:15 \
AM</font></tt><br> <tt><font face="Courier New">&gt; To: \
batik-users@xmlgraphics.apache.org</font></tt><br> <tt><font face="Courier New">&gt; \
Subject: Re: textpath &lt;path&gt; clone affects text positioning?</font></tt><br>
<tt><font face="Courier New">&gt; </font></tt><br>
<tt><font face="Courier New">&gt; &gt; FireFox and Renesis player seem to put
the text in correct place, however</font></tt><br>
<tt><font face="Courier New">&gt; &gt; batik svg viewer seems to somehow also
use the 'd' defined in the template</font></tt><br>
<tt><font face="Courier New">&gt; &gt; from where I clone the &lt;path&gt;
element so the text keeps changing whenever I</font></tt><br>
<tt><font face="Courier New">&gt; &gt; change the 'd' value in the 'template'
&lt;path&gt;.</font></tt><br>
<tt><font face="Courier New">&gt; &gt;</font></tt><br>
<tt><font face="Courier New">&gt; &gt; I need to try to make the svg behave
same in applet and the browsers.</font></tt><br>
<tt><font face="Courier New">&gt; </font></tt><br>
<tt><font face="Courier New">&gt; As always, creating and attaching a reduced
test case [1] to the</font></tt><br>
<tt><font face="Courier New">&gt; message may help receiving more and more
valuable feedback. (For this</font></tt><br>
<tt><font face="Courier New">&gt; case, apparently a single SVG file containing
a script snippet and</font></tt><br>
<tt><font face="Courier New">&gt; target path elements will do the \
trick.)</font></tt><br> <tt><font face="Courier New">&gt; </font></tt><br>
<tt><font face="Courier New">&gt; Just a though: are you deep cloning the
element (i.e.,</font></tt><br>
<tt><font face="Courier New">&gt; &quot;cloneNode(true)&quot; [2])?. If not,
then it is Firefox and Renesis who</font></tt><br>
<tt><font face="Courier New">&gt; may be suffering from issues, as non-deep
copies of DOM subtrees</font></tt><br>
<tt><font face="Courier New">&gt; should act as &quot;use&quot; elements, that
is, when you manipulate a non-deep</font></tt><br>
<tt><font face="Courier New">&gt; cloned element, the referenced element is the
one who is actually</font></tt><br>
<tt><font face="Courier New">&gt; changed.</font></tt><br>
<tt><font face="Courier New">&gt; </font></tt><br>
<tt><font face="Courier New">&gt; Hope this helps,</font></tt><br>
<tt><font face="Courier New">&gt; </font></tt><br>
<tt><font face="Courier New">&gt; &nbsp;Helder Magalhães</font></tt><br>
<tt><font face="Courier New">&gt; </font></tt><br>
<tt><font face="Courier New">&gt; [1] \
http://webkit.org/quality/reduction.html</font></tt><br> <tt><font face="Courier \
New">&gt; [2] http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-3A0ED0A4</font></tt><br>
 <tt><font face="Courier New">&gt; </font></tt><br>
<tt><font face="Courier New">&gt;
---------------------------------------------------------------------</font></tt><br>
<tt><font face="Courier New">&gt; To unsubscribe, e-mail:
batik-users-unsubscribe@xmlgraphics.apache.org</font></tt><br>
<tt><font face="Courier New">&gt; For additional commands, e-mail:
batik-users-help@xmlgraphics.apache.org</font></tt><br>
<tt><font face="Courier New">&gt; </font></tt><br>
<tt><font face="Courier New">&gt; </font></tt><br>
<tt><font face="Courier New">&gt; </font></tt><br>
<tt><font face="Courier New">&gt;
---------------------------------------------------------------------</font></tt><br>
<tt><font face="Courier New">&gt; To unsubscribe, e-mail:
batik-users-unsubscribe@xmlgraphics.apache.org</font></tt><br>
<tt><font face="Courier New">&gt; For additional commands, e-mail:
batik-users-help@xmlgraphics.apache.org</font></tt><br>
<tt><font face="Courier New">&gt; </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