tor-browser

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

2d.text.measure.strokeTextCluster-drawing-styles-change.tentative.html (3353B)


      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="stylesheet" href="/html/canvas/resources/canvas-grid-reftest.css">
      5 <link rel="match" href="2d.text.measure.strokeTextCluster-drawing-styles-change.tentative-expected.html">
      6 <title>Canvas test: 2d.text.measure.strokeTextCluster-drawing-styles-change.tentative</title>
      7 <h1>2d.text.measure.strokeTextCluster-drawing-styles-change.tentative</h1>
      8 <p class="desc">Test that strokeTextCluster() renders using the drawing styles as they were when `ctx.measureText()` was called, regardless of any changes in the context since.</p>
      9 
     10 <div class="grid-container" style="--grid-width: 2">
     11 <span>
     12  <div>letter_spacing</div>
     13  <canvas class="grid-cell-content" id="canvas0" width="250" height="80">
     14    <p class="fallback">FAIL (fallback content)</p>
     15  </canvas>
     16  <script type="module">
     17    const canvas = document.getElementById("canvas0");
     18    const ctx = canvas.getContext('2d');
     19 
     20    ctx.font = '20px serif';
     21    const text = 'Test ♦️ find';
     22 
     23    ctx.letterSpacing = '2px';
     24 
     25    let tm = ctx.measureText(text);
     26    const clusters = tm.getTextClusters();
     27 
     28    ctx.letterSpacing = '6px';
     29 
     30    for (const cluster of clusters) {
     31        ctx.strokeTextCluster(cluster, 10, 25);
     32    }
     33 
     34    ctx.strokeText(text, 10, 50);
     35  </script>
     36 </span>
     37 
     38 <span>
     39  <div>word_spacing</div>
     40  <canvas class="grid-cell-content" id="canvas1" width="250" height="80">
     41    <p class="fallback">FAIL (fallback content)</p>
     42  </canvas>
     43  <script type="module">
     44    const canvas = document.getElementById("canvas1");
     45    const ctx = canvas.getContext('2d');
     46 
     47    ctx.font = '20px serif';
     48    const text = 'Test ♦️ find';
     49 
     50    ctx.wordSpacing = '2px';
     51 
     52    let tm = ctx.measureText(text);
     53    const clusters = tm.getTextClusters();
     54 
     55    ctx.wordSpacing = '10px';
     56 
     57    for (const cluster of clusters) {
     58        ctx.strokeTextCluster(cluster, 10, 25);
     59    }
     60 
     61    ctx.strokeText(text, 10, 50);
     62  </script>
     63 </span>
     64 
     65 <span>
     66  <div>font_kerning</div>
     67  <canvas class="grid-cell-content" id="canvas2" width="250" height="80">
     68    <p class="fallback">FAIL (fallback content)</p>
     69  </canvas>
     70  <script type="module">
     71    const canvas = document.getElementById("canvas2");
     72    const ctx = canvas.getContext('2d');
     73 
     74    ctx.font = '20px serif';
     75    const text = 'Test ♦️ find';
     76 
     77    ctx.fontKerning = 'none';
     78 
     79    let tm = ctx.measureText(text);
     80    const clusters = tm.getTextClusters();
     81 
     82    ctx.fontKerning = 'normal';
     83 
     84    for (const cluster of clusters) {
     85        ctx.strokeTextCluster(cluster, 10, 25);
     86    }
     87 
     88    ctx.strokeText(text, 10, 50);
     89  </script>
     90 </span>
     91 
     92 <span>
     93  <div>font_variant_caps</div>
     94  <canvas class="grid-cell-content" id="canvas3" width="250" height="80">
     95    <p class="fallback">FAIL (fallback content)</p>
     96  </canvas>
     97  <script type="module">
     98    const canvas = document.getElementById("canvas3");
     99    const ctx = canvas.getContext('2d');
    100 
    101    ctx.font = '20px serif';
    102    const text = 'Test ♦️ find';
    103 
    104    ctx.fontVariantCaps = 'small-caps';
    105 
    106    let tm = ctx.measureText(text);
    107    const clusters = tm.getTextClusters();
    108 
    109    ctx.fontVariantCaps = 'all-small-caps';
    110 
    111    for (const cluster of clusters) {
    112        ctx.strokeTextCluster(cluster, 10, 25);
    113    }
    114 
    115    ctx.strokeText(text, 10, 50);
    116  </script>
    117 </span>
    118 
    119 </div>