tor-browser

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

fontface-descriptor-updates.html (2156B)


      1 <!DOCTYPE html>
      2 <html class=reftest-wait>
      3 <meta charset=utf-8>
      4 <title>CSS Font Loading test: modification of descriptors</title>
      5 <link rel="author" title="Jonathan Kew" href="jkew@mozilla.com">
      6 <link rel="help" href="https://drafts.csswg.org/css-font-loading/#fontface-interface">
      7 <meta name="assert" content="If descriptors of a FontFace are modified, the new values should take effect">
      8 <link rel="match" href="fontface-descriptor-updates-ref.html">
      9 <style>
     10 body { font-family: sans-serif; }
     11 #test1 { font-family: test1, sans-serif; }
     12 #test2 { font-family: test2, monospace; }
     13 #test3 { font-family: test3, sans-serif; }
     14 #test4 { font-family: test4, monospace; }
     15 </style>
     16 <script>
     17 function run() {
     18  let f1 = new FontFace("test1", "url(resources/GenR102.woff2)");
     19  document.fonts.add(f1);
     20  let f2 = new FontFace("to_be_updated", "url(resources/GenR102.woff2)");
     21  document.fonts.add(f2);
     22  let f3 = new FontFace("test3", "url(resources/GenR102.woff2)", { weight: 700 });
     23  document.fonts.add(f3);
     24  let f4 = new FontFace("test3", "url(resources/GenI102.woff2)");
     25  document.fonts.add(f4);
     26  let f5 = new FontFace("test4", "url(resources/GenR102.woff2)", { unicodeRange: "U+002?" });
     27  document.fonts.add(f5);
     28  let f6 = new FontFace("test4", "url(resources/GenI102.woff2)", { unicodeRange: "U+00??" });
     29  document.fonts.add(f6);
     30 
     31  // Change family name to make f2 match #test2
     32  f2.family = "test2";
     33 
     34  // Swap weight descriptors so that f3 is regular and f4 (italic face) is regarded as bold
     35  f3.weight = 400;
     36  f4.weight = 700;
     37 
     38  // Update unicode-range so that f5 will be used for all characters in #test4
     39  f5.unicodeRange = "U+00??";
     40  f6.unicodeRange = "U+0000";
     41 
     42  document.fonts.ready.then(function() {
     43    document.documentElement.classList.remove("reftest-wait");
     44  })
     45 }
     46 </script>
     47 <body onload="run()">
     48 <div>
     49 All lines below should use the same serif font, with the word "weight" in italics:
     50 <p id=test1>Using original family name of a FontFace</p>
     51 <p id=test2>Using updated family name of a FontFace</p>
     52 <p id=test3>Using updated <b>weight</b> descriptors</p>
     53 <p id=test4>Using updated unicode-range descriptors</p>
     54 </div>
     55 </body>
     56 </html>