canvas.2d.direction.inherit.canvas.html (911B)
1 <!doctype HTML> 2 <html dir="ltr"> 3 <meta charset="utf-8"> 4 <title>HTML5 Canvas Test: The direction attribute inherits from the canvas</title> 5 <link rel="match" href="canvas.2d.direction-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="When the canvas element has a dir attribute, override the document."/> 10 <script type="text/javascript"> 11 function runTest() { 12 var canvas = document.getElementById("canvas1"); 13 var ctx = canvas.getContext("2d"); 14 15 // The default for direction is inherit 16 ctx.font = "25px serif"; 17 ctx.fillText("ABC!", 60, 50); 18 } 19 </script> 20 <body onload="runTest()"> 21 <canvas dir="rtl" id="canvas1" width="300" height="150"> 22 Browser does not support HTML5 Canvas. 23 </canvas> 24 </body> 25 </html>