canvas.2d.direction.inherit.dynamic.canvas.html (927B)
1 <!doctype HTML> 2 <html dir="ltr"> 3 <meta charset="utf-8"> 4 <title>HTML5 Canvas Test: The direction attribute dynamically updates</title> 5 <link rel="match" href="canvas.2d.direction.dynamic-ref.html"/> 6 <link rel="author" href="mailto:schenney@chromium.org"/> 7 <link rel="help" 8 href="https://html.spec.whatwg.org/multipage/canvas.html#text-styles"/> 9 <meta name="assert" content="Verify that a text direction change is applied."/> 10 <script type="text/javascript"> 11 function runTest() { 12 var canvas = document.getElementById("canvas1"); 13 var ctx = canvas.getContext("2d"); 14 15 ctx.font = "25px serif"; 16 ctx.fillText("ABC!", 60, 50); 17 18 canvas.setAttribute("dir", "ltr"); 19 ctx.fillText("ABC!", 60, 100); 20 } 21 </script> 22 <body onload="runTest()"> 23 <canvas dir="rtl" id="canvas1" width="300" height="150"> 24 Browser does not support HTML5 Canvas. 25 </canvas> 26 </body> 27 </html>