text-dom-05-f-isvalid.html (5594B)
1 <!DOCTYPE html> 2 <html lang='en'> 3 <head> 4 <title>text-dom-05-f-manual.svg</title> 5 <meta charset='utf-8'> 6 </head> 7 <body> 8 <h1>Source SVG: text-dom-05-f-manual.svg</h1> 9 <svg version="1.1" baseProfile="full" 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-05-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 <text x='10' y='30' font-size='13'>Test that SVGTextContentElement methods work on UTF-16 code units</text> 32 <text x='10' y='60' font-size='11'>Methods that rely on layout</text> 33 <font-face font-family='SPlaneOne'> 34 <font-face-src> 35 <font-face-uri xlink:href="../resources/Plane1/PlaneOne.svg#SPlaneOne"/> 36 </font-face-src> 37 </font-face> 38 <style> 39 @font-face { 40 font-family: PlaneOne; 41 src: url(woffs/PlaneOne.woff) format("woff"); 42 } 43 </style> 44 45 <text id='t' x='50' y='50' visibility='hidden' font-family='PlaneOne, SPlaneOne' font-size='10' rotate='10 20 30'>a𐀀b</text> 46 47 <rect id='r3' x='10' y='120' width='30' height='30'/> 48 <text x='50' y='140'>getStartPositionOfChar</text> 49 50 <rect id='r4' x='10' y='160' width='30' height='30'/> 51 <text x='50' y='180'>getEndPositionOfChar</text> 52 53 <rect id='r5' x='10' y='200' width='30' height='30'/> 54 <text x='50' y='220'>getExtentOfChar</text> 55 56 <rect id='r6' x='10' y='240' width='30' height='30'/> 57 <text x='50' y='260'>getRotationOfChar</text> 58 59 <rect id='r7' x='10' y='280' width='30' height='30'/> 60 <text x='50' y='300'>getCharNumAtPosition</text> 61 62 <script><![CDATA[ 63 function $(x) { return document.getElementById(x) } 64 function eq(a, b) { 65 if (a.length != b.length) return false; 66 for (var i = 0; i < a.length; i++) if (a[i] != b[i]) return false; 67 return true; 68 } 69 function p(x, y) { 70 var p = document.documentElement.createSVGPoint(); 71 p.x = x; 72 p.y = y; 73 return p; 74 } 75 76 var t = $('t'); 77 var x, b; 78 79 b = false; 80 try { 81 x = [ 82 t.getStartPositionOfChar(0).x, 83 t.getStartPositionOfChar(1).x, 84 t.getStartPositionOfChar(2).x, 85 t.getStartPositionOfChar(3).x 86 ]; 87 b = eq(x, [50, 51, 51, 53]); 88 } catch (e) { 89 } 90 $('r3').setAttribute('fill', b ? 'green' : 'red'); 91 92 b = false; 93 try { 94 x = [ 95 t.getEndPositionOfChar(0).x, 96 t.getEndPositionOfChar(1).x, 97 t.getEndPositionOfChar(2).x, 98 t.getEndPositionOfChar(3).x 99 ]; 100 b = x[0] < x[1] && x[1] == x[2] && x[2] < x[3]; 101 } catch (e) { 102 } 103 $('r4').setAttribute('fill', b ? 'green' : 'red'); 104 105 b = false; 106 try { 107 x = [ 108 t.getExtentOfChar(0).width, 109 t.getExtentOfChar(1).width, 110 t.getExtentOfChar(2).width, 111 t.getExtentOfChar(3).width 112 ]; 113 b = eq(x, [1, 2, 2, 4]); 114 } catch (e) { 115 } 116 $('r5').setAttribute('fill', b ? 'green' : 'red'); 117 118 b = false; 119 try { 120 x = [ 121 t.getRotationOfChar(0), 122 t.getRotationOfChar(1), 123 t.getRotationOfChar(2), 124 t.getRotationOfChar(3) 125 ]; 126 b = eq(x, [10, 20, 20, 30]); 127 } catch (e) { 128 } 129 $('r6').setAttribute('fill', b ? 'green' : 'red'); 130 131 b = false; 132 try { 133 x = [ 134 t.getCharNumAtPosition(p(50.5, 49)), 135 t.getCharNumAtPosition(p(51.5, 49)), // within first half of the glyph represented by the two surrogates 136 t.getCharNumAtPosition(p(52.5, 49)), // within second half of the glyph represented by the two surrogates 137 t.getCharNumAtPosition(p(53.5, 49)) 138 ]; 139 b = eq(x, [0, 1, 2, 3]); 140 } catch (e) { 141 } 142 $('r7').setAttribute('fill', b ? 'green' : 'red'); 143 ]]></script> 144 </g> 145 <g font-family="SVGFreeSansASCII,sans-serif" font-size="32"> 146 <text id="revision" x="10" y="340" stroke="none" fill="black">$Revision: 1.6 $</text> 147 </g> 148 <rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000"/> 149 <!-- comment out this watermark once the test is approved --> 150 <g id="draft-watermark"> 151 <rect x="1" y="1" width="478" height="20" fill="red" stroke="black" stroke-width="1"/> 152 <text font-family="SVGFreeSansASCII,sans-serif" font-weight="bold" font-size="20" x="240" 153 text-anchor="middle" y="18" stroke-width="0.5" stroke="black" fill="white">DRAFT</text> 154 </g> 155 </svg> 156 </body> 157 </html>