canvas.2d.unknown.lang-ref.html (1406B)
1 <!doctype HTML> 2 <html class="reftest-wait"> 3 <meta charset="utf-8"> 4 <title>HTML5 Canvas Test Reference: The lang attribute.</title> 5 <link rel="author" href="mailto:schenney@chromium.org"/> 6 <script src="/common/reftest-wait.js"></script> 7 <style> 8 #canvas-en { 9 position: absolute; 10 top: 10px; 11 left: 10px; 12 } 13 #canvas-tr { 14 position: absolute; 15 top: 120px; 16 left: 10px; 17 } 18 </style> 19 <script> 20 function drawText(language) { 21 var canvas = document.getElementById('canvas-' + language); 22 var ctx = canvas.getContext('2d'); 23 24 // With no lang attribute anywhere, this will use the unknown language. 25 ctx.font = '25px Lato-Medium'; 26 ctx.fillText('fi', 5, 50); 27 } 28 function generateReference() { 29 let test_font = new FontFace( 30 // Lato-Medium is a font with language specific ligatures. 31 "Lato-Medium", 32 "url(/fonts/Lato-Medium.ttf)" 33 ); 34 35 test_font.load().then((font) => { 36 document.fonts.add(font); 37 drawText('tr'); 38 drawText('en'); 39 takeScreenshot(); 40 }); 41 } 42 </script> 43 <body onload="generateReference()"> 44 <canvas id="canvas-tr" width="300" height="100"> 45 Browser does not support HTML5 Canvas. 46 </canvas> 47 <canvas id="canvas-en" width="300" height="100"> 48 Browser does not support HTML5 Canvas. 49 </canvas> 50 </body> 51 </html>