mozPrintCallback-text-001-print.html (832B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1908969"> 4 <link rel="match" href="mozPrintCallback-text-001-print-ref.html"> 5 <link rel="stylesheet" href="/fonts/ahem.css"> 6 <style> 7 canvas { 8 background: yellow; 9 } 10 </style> 11 <canvas id="myCanvas" width="80" height="80"></canvas> 12 <script> 13 myCanvas.mozPrintCallback = function (obj) { 14 let ctx = obj.context; 15 ctx.font = "60px Ahem"; 16 // Draw the glyph using 'actualBoundingBoxAscent' as the y-position so that 17 // its top-edge is flush with the top of the canvas. (This makes it easier 18 // to position the glyph consistently between this testcase and the 19 // reference case.) 20 let yPos = ctx.measureText("X").actualBoundingBoxAscent; 21 ctx.fillText("X", 0, yPos); 22 obj.done(); 23 } 24 </script>