paths-dom-01-f-isvalid.html (5312B)
1 <!DOCTYPE html> 2 <html lang='en'> 3 <head> 4 <title>paths-dom-01-f-manual.svg</title> 5 <meta charset='utf-8'> 6 </head> 7 <body> 8 <h1>Source SVG: paths-dom-01-f-manual.svg</h1> 9 <svg version="1.1" baseProfile="full" onload="init();" id="svg-root" 10 width="100%" height="100%" viewBox="0 0 480 360" 11 xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> 12 <!--======================================================================--> 13 <!--= SVG 1.1 2nd Edition Test Case =--> 14 <!--======================================================================--> 15 <!--= Copyright 2009 World Wide Web Consortium, (Massachusetts =--> 16 <!--= Institute of Technology, European Research Consortium for =--> 17 <!--= Informatics and Mathematics (ERCIM), Keio University). =--> 18 <!--= All Rights Reserved. =--> 19 <!--= See http://www.w3.org/Consortium/Legal/. =--> 20 <!--======================================================================--> 21 22 <title id="test-title">$RCSfile: paths-dom-01-f.svg,v $</title> 23 <defs> 24 <font-face font-family="SVGFreeSansASCII" unicode-range="U+0-7F"> 25 <font-face-src> 26 <font-face-uri xlink:href="../resources/SVGFreeSans.svg#ascii"/> 27 </font-face-src> 28 </font-face> 29 </defs> 30 <g id="test-body-content" font-family="SVGFreeSansASCII,sans-serif" font-size="18"> 31 <script><![CDATA[ 32 function init() 33 { 34 var box = document.getElementById("box"); 35 var boxpl = document.getElementById("boxWithPathlength"); 36 37 document.getElementById("tl1").firstChild.data = box.getTotalLength(); 38 document.getElementById("tl2").firstChild.data = boxpl.getTotalLength(); 39 40 var pt = box.getPointAtLength(0); 41 document.getElementById("tp1").firstChild.data = "(" + pt.x + ", " + pt.y + ")"; 42 var circle = document.createElementNS("http://www.w3.org/2000/svg", "circle"); 43 circle.setAttribute("cx", pt.x); 44 circle.setAttribute("cy", pt.y); 45 circle.setAttribute("r", 3); 46 circle.setAttribute("fill", "blue"); 47 document.getElementById("test-body-content").appendChild(circle); 48 49 pt = boxpl.getPointAtLength(0); 50 document.getElementById("tp2").firstChild.data = "(" + pt.x + ", " + pt.y + ")"; 51 circle = document.createElementNS("http://www.w3.org/2000/svg", "circle"); 52 circle.setAttribute("cx", pt.x); 53 circle.setAttribute("cy", pt.y); 54 circle.setAttribute("r", 3); 55 circle.setAttribute("fill", "cyan"); 56 document.getElementById("test-body-content").appendChild(circle); 57 58 var segnum = box.getPathSegAtLength(0); 59 var seg = box.pathSegList.getItem(segnum); 60 document.getElementById("ts1").firstChild.data = segnum; 61 document.getElementById("tss1").firstChild.data = seg.pathSegTypeAsLetter + " " + seg.x + " " + seg.y; 62 63 segnum = boxpl.getPathSegAtLength(0); 64 seg = boxpl.pathSegList.getItem(segnum); 65 document.getElementById("ts2").firstChild.data = segnum; 66 document.getElementById("tss2").firstChild.data = seg.pathSegTypeAsLetter + " " + seg.x + " " + seg.y; 67 } 68 ]]></script> 69 <defs> 70 <path id="box" d="m 60 80 h 100 v 50 h -100 v -50" fill="green"/> 71 <path id="boxWithPathlength" d="m 300 80 h 100 v 50 h -100 v -50" fill="green" pathLength="100"/> 72 </defs> 73 <g font-size="14"> 74 <text x="30" y="30">Using startOffset="50":</text> 75 76 <use xlink:href="#box"/> 77 <text> 78 <textPath xlink:href="#box" startOffset="50"> 79 The text goes around the rect. 80 </textPath> 81 </text> 82 83 <text x="270" y="30">Using startOffset="50" and</text> 84 <text x="270" y="50">pathLength="100":</text> 85 <use xlink:href="#boxWithPathlength"/> 86 <text> 87 <textPath xlink:href="#boxWithPathlength" startOffset="50"> 88 The text goes around the rect. 89 </textPath> 90 </text> 91 92 <g id="dom-results" transform="translate(0,-10)"> 93 <text x="10" y="180">getTotalLength:</text> 94 <text x="60" y="200" id="tl1">-1</text> 95 <text x="300" y="200" id="tl2">-1</text> 96 97 <text x="10" y="220">getPointAtLength(0):</text> 98 <text x="60" y="240" id="tp1">-1</text> 99 <text x="300" y="240" id="tp2">-1</text> 100 101 <text x="10" y="260">getPathSegAtLength(0):</text> 102 <text x="60" y="280" id="ts1"> 103 -1<tspan x="60" dy="20" id="tss1">n/a</tspan> 104 </text> 105 <text x="300" y="280" id="ts2"> 106 -1<tspan x="300" dy="20" id="tss2">n/a</tspan> 107 </text> 108 </g> 109 </g> 110 </g> 111 <g font-family="SVGFreeSansASCII,sans-serif" font-size="32"> 112 <text id="revision" x="10" y="340" stroke="none" fill="black">$Revision: 1.6 $</text> 113 </g> 114 <rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000"/> 115 <!-- comment out this watermark once the test is approved --> 116 <g id="draft-watermark"> 117 <rect x="1" y="1" width="478" height="20" fill="red" stroke="black" stroke-width="1"/> 118 <text font-family="SVGFreeSansASCII,sans-serif" font-weight="bold" font-size="20" x="240" 119 text-anchor="middle" y="18" stroke-width="0.5" stroke="black" fill="white">DRAFT</text> 120 </g> 121 </svg> 122 </body> 123 </html>