OLD | NEW |
(Empty) | |
| 1 <!doctype html> |
| 2 <meta charset="utf-8"> |
| 3 <script src="../../resources/testharness.js"></script> |
| 4 <script src="../../resources/testharnessreport.js"></script> |
| 5 <html> |
| 6 <svg width="100" viewBox="0 0 200 400"> |
| 7 <title>Mixed Scripts and Writing Modes</title> |
| 8 <style type="text/css"> |
| 9 svg { |
| 10 font: 20px sans-serif; |
| 11 stroke-width: 2px; |
| 12 } |
| 13 </style> |
| 14 <g color="darkGreen" text-anchor="start"> |
| 15 <g id="sample" fill="currentColor" writing-mode="tb"> |
| 16 <text x="1em" y="2em">您好SVG</text> |
| 17 </g> |
| 18 </g> |
| 19 </svg> |
| 20 <script> |
| 21 var html = document.documentElement; |
| 22 var positions = []; |
| 23 var textElement = document.querySelector('text'); |
| 24 for (var i=0; i<5; i++) |
| 25 positions.push(textElement.getStartPositionOfChar(i).x); |
| 26 html.style.zoom = 2; |
| 27 for (var i=0; i<5; i++) { |
| 28 newPos = textElement.getStartPositionOfChar(i).x; |
| 29 test(function () { |
| 30 assert_approx_equals(newPos, positions[i], 1); |
| 31 }, "Position of character index " + i + " unaffected by zoom level"); |
| 32 } |
| 33 html.style.zoom = 1; |
| 34 </script> |
| 35 <div id="log"></div> |
OLD | NEW |