font-size-adjust-012-ref.html (2997B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>CSS Test: font-size-adjust property</title> 6 <link rel="help" href="https://www.w3.org/TR/css-fonts-4/#font-size-adjust-prop"> 7 <style> 8 @font-face { 9 font-family: 'ahem-ex-500'; 10 src: url('./resources/ahem-ex-500.otf') format('opentype'); 11 } 12 @font-face { 13 font-family: 'ahem-ex-250'; 14 src: url('./resources/ahem-ex-250.otf') format('opentype'); 15 } 16 .wrapper { 17 --primary-font: 'ahem-ex-500'; 18 --secondary-font: 'ahem-ex-250'; 19 } 20 .test { 21 font-family: var(--primary-font), var(--secondary-font); 22 font-size: 100px; 23 line-height: 1; 24 color: peru; 25 height: 100px; 26 } 27 .primary-font { 28 font-family: var(--primary-font); 29 } 30 .secondary-font { 31 font-family: var(--secondary-font); 32 } 33 .tall-inline-block { 34 display: inline-block; 35 height: 100px; 36 } 37 .description { 38 font-family: 'Times New Roman'; 39 font-size: 14px; 40 } 41 .main { 42 font-size: 16px; 43 margin-bottom: 8px; 44 } 45 </style> 46 </head> 47 <body> 48 <div class="description main">For this test we are using two fonts. AhemEx500 has a aspect value (xHeight/size) of 0.5 and AhemEx250 an aspect value of 0.25. On both fonts all glyphs used in the tests look like a square but AhemEx500 doesn't contain 'A' (U+0041).</div> 49 <div class="wrapper"> 50 <div class="description">1. Same glyph x in different spans with different fonts. The second one is adjusted with font-size-adjust. They should have the same size for test to pass.</div> 51 <div class="test"> 52 <span class="primary-font">xx</span> 53 </div> 54 </div> 55 <div class="wrapper"> 56 <div class="description"> 57 2. Different glyphs 'x' and 'A' in the same span, with 2 fonts in font-family fallback and <em>without</em> font-size-adjust. The second glyph can't be rendered by primary font so it will individually fallback to the secondary font. Note it is smaller than the first glyph. 58 </div> 59 <div class="test"><span>xA</span></div> 60 </div> 61 <div class="wrapper"> 62 <div class="description"> 63 3. Different glyphs 'x' and 'A' in the same span, with 2 fonts in font-family fallback and <em>with</em> font-size-adjust. The second glyph can't be rendered by primary font so it will individually fallback to the secondary font. Note that now they have the same size. 64 </div> 65 <div class="test"> 66 <!-- We are inserting a tall inline-block here to make the position of the baseline independent of the adjusted glyph since on the ref test we don't use font-size-adjust but font-size --> 67 <span>xx<span class="tall-inline-block"></span></span> 68 </div> 69 </div> 70 </html>