cssom-fontfacerule.html (1806B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>CSSOM Parsing Test: @font-face rules parsed into CSSOM CSSFontFaceRules</title> 5 <link rel="author" title="Paul Irish" href="mailto:paul.irish@gmail.com"> 6 <link rel="help" href="https://drafts.csswg.org/css-fonts-4/#om-fontface"> 7 8 <meta name="flags" content="dom"> 9 10 <script src="/resources/testharness.js"></script> 11 <script src="/resources/testharnessreport.js"></script> 12 </head> 13 14 <body> 15 <div id="log"></div> 16 17 18 <style id="teststyles"> 19 @font-face { 20 src: url(http://foo/bar/font.ttf); 21 } 22 @font-face { 23 font-family: STIXGeneral; 24 src: local(STIXGeneral), url(/stixfonts/STIXGeneral.otf); 25 unicode-range: U+000-49F, U+2000-27FF, U+2900-2BFF, U+1D400-1D7FF; 26 } 27 @font-face { 28 font-family: MainText; 29 src: url(http://example.com/font.ttf); 30 font-variant: oldstyle-nums proportional-nums styleset(1,3); 31 } 32 33 @font-face { 34 font-family: BodyText; 35 src: local("HiraMaruPro-W4"); 36 font-variant: proportional-width; 37 font-feature-settings: "ital"; /* Latin italics within CJK text feature */ 38 } 39 </style> 40 41 42 <script> 43 var validRules = document.getElementById('teststyles').sheet.cssRules; 44 45 test(function(){ 46 47 assert_equals(validRules[0].style.src, 'url("http://foo/bar/font.ttf")'); 48 assert_equals(validRules[1].style.fontFamily, 'STIXGeneral'); 49 50 /* unimplemented @font-face properties are not represented in CSSOM */ 51 52 }, 'CSSStyleDeclaration values are represented within CSSFontFaceRule') 53 54 </script> 55 56 57 </body> 58 </html>