| OLD | NEW | 
|---|
| (Empty) |  | 
|  | 1 <!DOCTYPE HTML> | 
|  | 2 <meta charset="utf8"> | 
|  | 3 <style> | 
|  | 4     .commonLigatures { | 
|  | 5         font-variant-ligatures: common-ligatures; | 
|  | 6     } | 
|  | 7     .noselect { | 
|  | 8         -webkit-user-select: none; | 
|  | 9         user-select: none; | 
|  | 10     } | 
|  | 11 </style> | 
|  | 12 <svg width="600px" height="500px" xmlns="http://www.w3.org/2000/svg"> | 
|  | 13     <defs> | 
|  | 14         <path id="path" d="M 25 400 C 300 400 200 200 500 450" /> | 
|  | 15     </defs> | 
|  | 16     <g id="container"/> | 
|  | 17     <g font-family="Arial" font-size="50px"> | 
|  | 18         <text x="25" y="50" class="commonLigatures" font-family="cursive">öh &#x
    443;̌eah! fi ffi abcffidef</text> | 
|  | 19         <text x="25" y="150" class="commonLigatures" font-family="serif">öh 
    43;̌eah! fi ffi abcffidef</text> | 
|  | 20         <text x="25" y="250" class="commonLigatures" font-family="sans-serif">öh
     у̌eah! fi ffi abcffidef</text> | 
|  | 21         <use xlink:href="#path" stroke-width="2" stroke="black" fill="transparen
    t"/> | 
|  | 22         <text x="25" y="350" class="commonLigatures" font-family="cursive"> | 
|  | 23             <textPath xlink:href="#path">ffiffiffiffiffiffiffiffiffiffiffi</text
    Path> | 
|  | 24         </text> | 
|  | 25       </text> | 
|  | 26     </g> | 
|  | 27 </svg> | 
|  | 28 <script> | 
|  | 29     function highlightGlyph(text, index, color) { | 
|  | 30         var extent = text.getExtentOfChar(index); | 
|  | 31 | 
|  | 32         // Highlight rect that we've selected using the extent information | 
|  | 33         var rectElement = document.createElementNS("http://www.w3.org/2000/svg",
     "rect"); | 
|  | 34         rectElement.setAttribute("x", extent.x); | 
|  | 35         rectElement.setAttribute("y", extent.y); | 
|  | 36         rectElement.setAttribute("width", extent.width); | 
|  | 37         rectElement.setAttribute("height", extent.height); | 
|  | 38         rectElement.setAttribute("fill-opacity", "0.5"); | 
|  | 39         rectElement.setAttribute("fill", color); | 
|  | 40         document.getElementById("container").appendChild(rectElement); | 
|  | 41         // Output the start offset | 
|  | 42         var textElement = document.createElementNS("http://www.w3.org/2000/svg",
     "text"); | 
|  | 43         textElement.setAttribute("x", extent.x + extent.width / 2); | 
|  | 44         textElement.setAttribute("y", extent.y + extent.height + 5); | 
|  | 45         textElement.setAttribute("text-anchor", "middle"); | 
|  | 46         textElement.setAttribute("font-size", 10); | 
|  | 47         textElement.setAttribute("class", "noselect"); | 
|  | 48         textElement.appendChild(document.createTextNode(index)); | 
|  | 49         document.getElementById("container").appendChild(textElement); | 
|  | 50     } | 
|  | 51 | 
|  | 52     var colors = ["red", "orange", "yellow", "green", "blue", "indigo", "violet"
    ]; | 
|  | 53     // Highlight each glyph with a semi-transparent rectangle and | 
|  | 54     // a number corresponding to the queried character index. | 
|  | 55     var textElements = document.querySelectorAll("text"); | 
|  | 56     for (var elemNum = 0; elemNum < textElements.length; ++elemNum) { | 
|  | 57         var text = textElements[elemNum]; | 
|  | 58         var charCount = text.getNumberOfChars(); | 
|  | 59         for (var index = 0; index < charCount; ++index) | 
|  | 60             highlightGlyph(text, index, colors[index % colors.length]); | 
|  | 61     } | 
|  | 62 </script> | 
| OLD | NEW | 
|---|