tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

text-dom-01-f-isvalid.html (9133B)


      1 <!DOCTYPE html>
      2 <html lang='en'>
      3 <head>
      4 <title>text-dom-01-f-manual.svg</title>
      5 <meta charset='utf-8'>
      6 </head>
      7 <body>
      8 <h1>Source SVG: text-dom-01-f-manual.svg</h1>
      9 <svg version="1.1" baseProfile="full" onload="testSVGTextContentElement()" 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: text-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 type="text/ecmascript"><![CDATA[
     32      function testSVGTextContentElement() {
     33      var svgNS = "http://www.w3.org/2000/svg";
     34      var tContentEl = document.getElementById("testText");
     35      var textGroup = document.getElementById("textGroup");
     36      var svgPt = document.documentElement.createSVGPoint();
     37      svgPt.x = 240;
     38      svgPt.y = 25;
     39 
     40      //1: testing .getCharNumAtPosition()
     41      var charNumresult = tContentEl.getCharNumAtPosition(svgPt);
     42      document.getElementById("text1").firstChild.data = ".getCharNumAtPosition() result: "+charNumresult;
     43 
     44      //2: testing .getCharNumAtPosition()
     45      var compTextLength = tContentEl.getComputedTextLength();
     46      document.getElementById("text2").firstChild.data = ".getComputedTextLength() result: "+Math.round(compTextLength);
     47      var baseLine = document.createElementNS(svgNS,"line");
     48      baseLine.setAttributeNS(null,"stroke","red");
     49      baseLine.setAttributeNS(null,"x1",(240 - compTextLength * 0.5));
     50      baseLine.setAttributeNS(null,"x2",(240 + compTextLength * 0.5));
     51      baseLine.setAttributeNS(null,"y1",30);
     52      baseLine.setAttributeNS(null,"y2",30);
     53      textGroup.insertBefore(baseLine,tContentEl);
     54 
     55      //3: testing .getEndPositionOfChar(), end of character
     56      var endPosChar = tContentEl.getEndPositionOfChar(11);
     57      document.getElementById("text3").firstChild.data = ".getEndPositionOfChar(11) result ('e'): "+Math.round(endPosChar.x)+","+Math.round(endPosChar.y);
     58      var endPosLine = document.createElementNS(svgNS,"line");
     59      endPosLine.setAttributeNS(null,"stroke","red");
     60      endPosLine.setAttributeNS(null,"x1",endPosChar.x);
     61      endPosLine.setAttributeNS(null,"x2",endPosChar.x);
     62      endPosLine.setAttributeNS(null,"y1",endPosChar.y);
     63      endPosLine.setAttributeNS(null,"y2",endPosChar.y-15);
     64      textGroup.insertBefore(endPosLine,tContentEl);
     65 
     66      //4: testing getExtentOfChar
     67      var charExtent = tContentEl.getExtentOfChar(11);
     68      document.getElementById("text4").firstChild.data = ".getExtentOfChar(11) result ('e'): "+Math.round(charExtent.x)+","+Math.round(charExtent.y)+","+Math.round(charExtent.width)+","+Math.round(charExtent.height);
     69      var extentRect = document.createElementNS(svgNS,"rect");
     70      extentRect.setAttributeNS(null,"fill","lightblue");
     71      extentRect.setAttributeNS(null,"x",charExtent.x);
     72      extentRect.setAttributeNS(null,"y",charExtent.y);
     73      extentRect.setAttributeNS(null,"width",charExtent.width);
     74      extentRect.setAttributeNS(null,"height",charExtent.height);
     75      textGroup.insertBefore(extentRect,baseLine);
     76 
     77      //5: testing getNumberOfChars
     78      var numChars = tContentEl.getNumberOfChars();
     79      document.getElementById("text5").firstChild.data = ".getNumberOfChars() result: "+numChars;
     80 
     81      //6: testing getRotationOfChar
     82      var charRot = tContentEl.getRotationOfChar(5);
     83      document.getElementById("text6").firstChild.data = ".getRotationOfChar(5) result: "+charRot;
     84      var rotCharExtent = tContentEl.getExtentOfChar(5);
     85      var rotExtentRect = document.createElementNS(svgNS,"rect");
     86      rotExtentRect.setAttributeNS(null,"fill","lightblue");
     87      rotExtentRect.setAttributeNS(null,"x",rotCharExtent.x);
     88      rotExtentRect.setAttributeNS(null,"y",rotCharExtent.y);
     89      rotExtentRect.setAttributeNS(null,"width",rotCharExtent.width);
     90      rotExtentRect.setAttributeNS(null,"height",rotCharExtent.height);
     91      textGroup.insertBefore(rotExtentRect,baseLine);
     92 
     93      //7: testing .getStartPositionOfChar(), end of character
     94      var startPosChar = tContentEl.getStartPositionOfChar(11);
     95      document.getElementById("text7").firstChild.data = ".getStartPositionOfChar(11) result ('e'): "+Math.round(startPosChar.x)+","+Math.round(startPosChar.y);
     96      var startPosLine = document.createElementNS(svgNS,"line");
     97      startPosLine.setAttributeNS(null,"stroke","red");
     98      startPosLine.setAttributeNS(null,"x1",startPosChar.x);
     99      startPosLine.setAttributeNS(null,"x2",startPosChar.x);
    100      startPosLine.setAttributeNS(null,"y1",startPosChar.y);
    101      startPosLine.setAttributeNS(null,"y2",startPosChar.y-15);
    102      textGroup.insertBefore(startPosLine,tContentEl);
    103 
    104      //8: testing .getSubStringLength()
    105      var startPosInterface = tContentEl.getStartPositionOfChar(22);
    106      var subStrLength = tContentEl.getSubStringLength(22,9);
    107      document.getElementById("text8").firstChild.data = ".getSubStringLength(22,9) result ('interface'): "+Math.round(subStrLength);
    108      var subStrLine = document.createElementNS(svgNS,"line");
    109      subStrLine.setAttributeNS(null,"stroke","lime");
    110      subStrLine.setAttributeNS(null,"x1",startPosInterface.x);
    111      subStrLine.setAttributeNS(null,"x2",(startPosInterface.x+subStrLength));
    112      subStrLine.setAttributeNS(null,"y1",startPosInterface.y);
    113      subStrLine.setAttributeNS(null,"y2",startPosInterface.y);
    114      textGroup.insertBefore(subStrLine,tContentEl);
    115 
    116      //9: testing .selectSubString()
    117      tContentEl.selectSubString(18,3);
    118 
    119      //10: testing textLength.baseVal.value
    120      var tlbaseval = tContentEl.textLength.baseVal.value;
    121      document.getElementById("text10").firstChild.data = ".textLength.baseVal.value result: "+Math.round(tlbaseval);
    122 
    123      //11: testing textLength.baseVal.value
    124      var tlanimval = tContentEl.textLength.animVal.value;
    125      document.getElementById("text11").firstChild.data = ".textLength.animVal.value result: "+Math.round(tlanimval);
    126 
    127      //12: testing lengthAdjust baseVal and animVal
    128      document.getElementById("text12").firstChild.data = ".lengthAdjust.baseVal and .lengthAdjust.animVal result: "+tContentEl.lengthAdjust.baseVal+","+tContentEl.lengthAdjust.animVal;;
    129      }
    130    ]]></script>
    131    <g id="textGroup" font-family="Arial" font-size="15">
    132      <text x="240" y="30" text-anchor="middle" id="testText">
    133        This <tspan rotate="45,90">is</tspan> a test of the interface SVGTextContentElement.
    134      </text>
    135      <text id="text1" x="30" y="60">.getCharNumAtPosition() result: </text>
    136      <text id="text2" x="30" y="80">.getComputedTextLength() result: </text>
    137      <text id="text3" x="30" y="100">.getEndPositionOfChar(11) result ('e'): </text>
    138      <text id="text4" x="30" y="120">.getExtentOfChar(11) result ('e'): </text>
    139      <text id="text5" x="30" y="140">.getNumberOfChars() result: </text>
    140      <text id="text6" x="30" y="160">.getRotationOfChar(5) result: </text>
    141      <text id="text7" x="30" y="180">.getStartPositionOfChar(11) result: </text>
    142      <text id="text8" x="30" y="200">.getSubStringLength(22,9) result ('interface'): </text>
    143      <text id="text9" x="30" y="220">.selectSubString(18,3) result: the word 'the' should be selected</text>
    144      <text id="text10" x="30" y="240">.textLength.baseVal.value result:</text>
    145      <text id="text11" x="30" y="260">.textLength.animVal.value result:</text>
    146      <text id="text12" x="30" y="280">.lengthAdjust.baseVal and .lengthAdjust.animVal result:</text>
    147    </g>
    148  </g>
    149  <g font-family="SVGFreeSansASCII,sans-serif" font-size="32">
    150    <text id="revision" x="10" y="340" stroke="none" fill="black">$Revision: 1.4 $</text>
    151  </g>
    152  <rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000"/>
    153  <!-- comment out this watermark once the test is approved -->
    154  <g id="draft-watermark">
    155    <rect x="1" y="1" width="478" height="20" fill="red" stroke="black" stroke-width="1"/>
    156    <text font-family="SVGFreeSansASCII,sans-serif" font-weight="bold" font-size="20" x="240"
    157      text-anchor="middle" y="18" stroke-width="0.5" stroke="black" fill="white">DRAFT</text>
    158  </g>
    159 </svg>
    160 </body>
    161 </html>