2d.text.measure.strokeTextCluster-font-change.tentative.html (1047B)
1 <!DOCTYPE html> 2 <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> 3 <meta charset="UTF-8"> 4 <link rel="match" href="2d.text.measure.strokeTextCluster-font-change.tentative-expected.html"> 5 <title>Canvas test: 2d.text.measure.strokeTextCluster-font-change.tentative</title> 6 <h1>2d.text.measure.strokeTextCluster-font-change.tentative</h1> 7 <p class="desc">Test that strokeTextCluster() renders in the font used originally when the text was measured, even if the font set on the context has changed since.</p> 8 <canvas id="canvas" width="500" height="200"> 9 <p class="fallback">FAIL (fallback content)</p> 10 </canvas> 11 <script> 12 const canvas = document.getElementById("canvas"); 13 const ctx = canvas.getContext('2d'); 14 15 ctx.font = '50px sans-serif'; 16 const text = 'Hello ♦️ World!'; 17 let tm = ctx.measureText(text); 18 const clusters = tm.getTextClusters(); 19 20 ctx.font = '80px serif'; 21 22 const x = 100; 23 const y = 100; 24 for (const cluster of clusters) { 25 ctx.strokeTextCluster(cluster, x, y); 26 } 27 </script>