lewisje / svgweb

Automatically exported from code.google.com/p/svgweb
Other
0 stars 0 forks source link

New SVG text node does not honor text attributes in enclosing <g> tag (regression) #546

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.Open file below with appropriate location of svgweb
2.Compare svg.render.forceflash=true vs false.
3.Compare with svgweb version Beholder

What is the expected output? What do you see instead?
Correct output is only black text visible.
Actual shows colored text.  Beholder shows correct output.

What version of the product are you using? On what operating system,
browser, and version of Flash?
Windows Xp, IE (flash only), Firefox, Chrome.  Flash version 10.

Please provide any additional information below. Reduced test cases are
always appreciated!

<html >
<head>
<script src="http://codinginparadise.org/projects/svgweb-staging/src/svg.js"
 data-path="src/"
 type="text/javascript"
 data-debug="true" ></script>
<script>

 function add_text(x,y,t) {
  var txt = document.createElementNS('http://www.w3.org/2000/svg','text');
  txt.setAttribute( 'x', x );
  txt.setAttribute( 'y', y );
  txt.setAttribute('fill','black');
  txt.appendChild(document.createTextNode(t,true));
  return txt;
 }

    function init(evt) {
        document.getElementById("ta_none").appendChild(add_text(0,0,'text-anchor:none'))
        document.getElementById("ta_start").appendChild(add_text(0,0,'text-anchor:start'))
        document.getElementById("ta_middle").appendChild(add_text(0,0,'text-anchor:middle'))
        document.getElementById("ta_end").appendChild(add_text(0,0,'text-anchor:end'))
    }
</script>
</head>
<body onsvgload="init()">
<script type="image/svg+xml">
<svg xmlns="http://www.w3.org/2000/svg"  id="svg-root" width="100%" 
height="100%" viewBox="0 0 480 360" version="1.1" baseProfile="basic">

   <title id="test-title">text-align-01-b</title>

   <desc id="test-desc">Test 'text-anchor' property (horizontal).</desc>
   <!--======================================================================-->
   <!--Content of Test Case follows...                  =====================-->
   <!--======================================================================-->
   <g id="test-body-content">
      <text font-family="Arial" font-size="34"  x="5" y="40">Test 'text-anchor' (horizontal)</text>
      <g id="text-anchor" font-family="Arial" font-size="14" >
         <g id="ta_none" transform="translate(230,130)" text-anchor="none" font-size="30" >
                     <circle r="3"/>
                     <text fill="red" >text-anchor:none</text>
         </g>
         <g id="ta_start" transform="translate(230,180)" text-anchor="start" font-size="30">
            <circle r="3"/>
            <text fill="red" >text-anchor:start</text>

         </g>
         <g id="ta_middle" transform="translate(230,230)" text-anchor="middle" font-size="30">
            <circle r="3"/>
            <text fill="green" >text-anchor:middle</text>
         </g>
         <g id="ta_end" transform="translate(230,280)" text-anchor="end" font-size="30">
            <circle r="3"/>
            <text fill="blue" >text-anchor:end</text>
         </g>
      </g>
   </g>
   <rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000000"/>
</svg>
</script>

</body>
</html>

Original issue reported on code.google.com by bruce.ri...@gmail.com on 30 Aug 2010 at 10:53

GoogleCodeExporter commented 8 years ago
I have not been able to confirm that this is a regression.
Old Beholder does not appear to display the black text at all, in native or 
flash mode.

The latest release improves this on both fronts - native mode looks right and 
flash mode displays the black text but does not honor the <g> attributes as 
reported.

Tested on Firefox on Ubuntu.

Original comment by grick23@gmail.com on 6 Sep 2010 at 5:59

GoogleCodeExporter commented 8 years ago
Change the line:
<body onsvgload="init()">
to
<body onload="init()">
on the earlier versions. This will show the regression

Original comment by bruce.ri...@gmail.com on 8 Sep 2010 at 3:09

GoogleCodeExporter commented 8 years ago
Thanks Bruce. You are right. It is a regression. Sorry about that. The problem 
was introduced in r1048.

Fixed in r1235

Original comment by grick23@gmail.com on 15 Sep 2010 at 4:19

GoogleCodeExporter commented 8 years ago
Downloaded the new svg.swf and it seems to work perfectly.
Thanks!

Original comment by bruce.ri...@gmail.com on 15 Sep 2010 at 11:22