canvas.2d.direction.inherit.disconnected.canvas.html (1020B)
1 <!doctype HTML> 2 <meta charset="utf-8"> 3 <title>HTML5 Canvas Test: The direction attribute inherits from a disconnected canvas element</title> 4 <link rel="match" href="canvas.2d.direction-ref.html"/> 5 <link rel="author" href="mailto:schenney@chromium.org"/> 6 <link rel="help" 7 href="https://html.spec.whatwg.org/multipage/canvas.html#text-styles"/> 8 <meta name="assert" content="Verify that a disconnected canvas with no style uses the canvas direction."/> 9 <style> 10 canvas { 11 position: absolute; 12 top: 8px; 13 left: 8px; 14 } 15 </style> 16 <canvas id="canvas1" width="300" height="150"> 17 Browser does not support HTML5 Canvas. 18 </canvas> 19 <script type="text/javascript"> 20 var canvas = document.createElement("canvas"); 21 canvas.setAttribute("dir", "rtl"); 22 canvas.setAttribute("width", "300"); 23 canvas.setAttribute("height", "150"); 24 var ctx = canvas.getContext("2d"); 25 26 // The default for direction is inherit. 27 ctx.font = "25px serif"; 28 ctx.fillText("ABC!", 60, 50); 29 30 document.body.appendChild(canvas); 31 </script>