tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

2d.text.measure.fillTextCluster-font-change.tentative.html (1149B)


      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.fillTextCluster-font-change.tentative-expected.html">
      5 <title>Canvas test: 2d.text.measure.fillTextCluster-font-change.tentative</title>
      6 <h1>2d.text.measure.fillTextCluster-font-change.tentative</h1>
      7 <p class="desc">Test that fillTextCluster() 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 = new OffscreenCanvas(500, 200);
     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.fillTextCluster(cluster, x, y);
     26  }
     27 
     28  const outputCanvas = document.getElementById("canvas");
     29  outputCanvas.getContext('2d').drawImage(canvas, 0, 0);
     30 </script>