tor-browser

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

getsubstringlength-emoji-ligatures.html (1011B)


      1 <!DOCTYPE html>
      2 <title>SVGTextContentElement.getSubStringLength on Emoji with ligatures</title>
      3 <script src="/resources/testharness.js"></script>
      4 <script src="/resources/testharnessreport.js"></script>
      5 <svg>
      6  <g font-size="50" text-rendering="geometricPrecision">
      7    <text y="50">๐Ÿ‘ฆ</text>
      8    <text y="100">๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ฆ</text>
      9    <text y="50" x="100">๐Ÿ‘จโ€</text>
     10    <text y="100" x="100">๐Ÿ‘ฉ๐Ÿฝโ€๐ŸŒพ</text>
     11    <text y="50" x="150">๐Ÿ‘จโ€๐Ÿ‘ฆ</text>
     12    <text y="100" x="150">๐Ÿ‘ฑ๐Ÿฝโ€โ™‚๏ธ</text>
     13    <text y="50" x="200">๐ŸŽ…๐Ÿฝ</text>
     14  </g>
     15 </svg>
     16 <script>
     17 test(function() {
     18  for (const element of Array.from(document.getElementsByTagName('text'))) {
     19    const subStringLength = element.getSubStringLength(0, element.getNumberOfChars());
     20    const bboxWidth = element.getBBox().width;
     21    // Expect the value computed by getSubStringLength() to roughly
     22    // match the value computed for the bbox.
     23    assert_approx_equals(subStringLength, bboxWidth, 1);
     24  }
     25 });
     26 </script>