canvas.2d.fillText-FontFace.html (895B)
1 <!DOCTYPE html> 2 <html class="reftest-wait"> 3 <head> 4 <title>HTML 5 Canvas Test: fillText() after loading a FontFace and transferControlToOffscreen draws text</title> 5 <link rel="mismatch" href="empty-ref.html"> 6 <meta charset="utf-8"> 7 <meta name="assert" content="fillText() after loading a FontFace and transferControlToOffscreen() draws text"> 8 <script src="/common/reftest-wait.js"></script> 9 </head> 10 <body onload="runTest()"> 11 <canvas id="c"></canvas> 12 <script> 13 function runTest() { 14 let test_font = new FontFace( 15 "Lato-Medium", 16 "url(/fonts/Lato-Medium.ttf)" 17 ); 18 19 test_font.load().then(font => { 20 const c = document.getElementById("c"); 21 const ctx = c.transferControlToOffscreen().getContext("2d"); 22 // This should also draw text without setting the font. 23 ctx.fillText("T", 5, 50); 24 takeScreenshot(); 25 }); 26 } 27 </script> 28 </body> 29 </html>