canvas.2d.lang.empty.canvas.html (1394B)
1 <!doctype HTML> 2 <html class="reftest-wait"> 3 <meta charset="utf-8"> 4 <title>HTML5 Canvas Test: The empty string lang attribute uses the unknown language</title> 5 <link rel="match" href="canvas.2d.lang.empty-ref.html" /> 6 <link rel="author" href="mailto:schenney@chromium.org"/> 7 <link rel="help" href="https://html.spec.whatwg.org/multipage/canvas.html#text-styles"/> 8 <meta name="assert" content="When the lang attribute is the empty string, use the unknown language." /> 9 <script src="/common/reftest-wait.js"></script> 10 <script type="text/javascript"> 11 function runTest() { 12 let test_font = new FontFace( 13 // Lato-Medium is a font with language specific ligatures. 14 "Lato-Medium", 15 "url(/fonts/Lato-Medium.ttf)" 16 ); 17 18 test_font.load().then((font) => { 19 document.fonts.add(font); 20 var canvas = document.getElementById('canvas1'); 21 var ctx = canvas.getContext('2d'); 22 23 // An empty lang string should produce the same result as no language 24 // attribute at all, on the canvas element or document element. 25 ctx.font = '25px Lato-Medium'; 26 ctx.lang = ''; 27 ctx.fillText('fi', 5, 50); 28 takeScreenshot(); 29 }); 30 } 31 </script> 32 <body onload="runTest()"> 33 <canvas id="canvas1" width="300" height="150"> 34 Browser does not support HTML5 Canvas. 35 </canvas> 36 </body> 37 </html>