tor-browser

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

2d.text.measure.lang.html (1359B)


      1 <!DOCTYPE html>
      2 <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
      3 <meta charset="UTF-8">
      4 <title>Canvas test: 2d.text.measure.lang</title>
      5 <script src="/resources/testharness.js"></script>
      6 <script src="/resources/testharnessreport.js"></script>
      7 <script src="/html/canvas/resources/canvas-tests.js"></script>
      8 <link rel="stylesheet" href="/html/canvas/resources/canvas-tests.css">
      9 <style>
     10 @font-face {
     11  font-family: Lato-Medium;
     12  src: url("/fonts/Lato-Medium.ttf");
     13 }
     14 </style>
     15 <body class="show_output">
     16 
     17 <h1>2d.text.measure.lang</h1>
     18 <p class="desc">Testing the lang attribute</p>
     19 
     20 
     21 <span style="font-family: Lato-Medium; position: absolute; visibility: hidden">A</span>
     22 <p class="output">Actual output:</p>
     23 <canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
     24 
     25 <ul id="d"></ul>
     26 <script>
     27 promise_test(async t => {
     28 
     29  var canvas = document.getElementById('c');
     30  var ctx = canvas.getContext('2d');
     31 
     32  await document.fonts.ready;
     33 
     34  ctx.font = '50px Lato-Medium';
     35  ctx.lang = 'tr';
     36  const text = 'fi';
     37  const tm_tr = ctx.measureText(text);
     38  const tr_width = tm_tr.width;
     39 
     40  ctx.lang = 'en';
     41  const tm_en = ctx.measureText(text);
     42  const en_width = tm_en.width;
     43 
     44  _assert(tr_width > en_width, "tr_width > en_width");
     45 
     46 }, "Testing the lang attribute");
     47 </script>