font-size-adjust-metrics-override.html (1843B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <link rel="author" href="mailto:changseok@webkit.org"> 4 <link rel="match" href="font-size-adjust-metrics-override-ref.html"> 5 <link rel="help" href="https://www.w3.org/TR/css-fonts-5/#font-size-adjust-prop"> 6 <meta name="assert" content="Tests the simultaneous use of font-size-adjust and metrics override descriptors of @font-face"> 7 <title>Tests if font metric overrides reflect the adjustment of font-size-adjust.</title> 8 <style> 9 @font-face { 10 font-family: Ahem; 11 src: local(Ahem), url(/fonts/Ahem.ttf); 12 /* The default ascent and descent are 80% and 20%, respectively. */ 13 ascent-override: 100%; 14 descent-override: 50%; 15 } 16 17 .size-adjusted { 18 font: 20px Ahem; 19 /* Scale up 200% since the Ahem font has an aspect ratio of 0.8 of x-height 20 to size. */ 21 font-size-adjust: 1.6; 22 color: green; 23 position: absolute; 24 top: 10px; 25 left: 10px; 26 } 27 28 .overridden-ascent-ref { 29 display: inline-block; 30 background-color: green; 31 vertical-align: top; 32 width: 1em; 33 height: 1em; /* Scale a reference block to match the overridden ascent of 100%. */ 34 } 35 36 .overridden-descent-ref { 37 display: inline-block; 38 background-color: green; 39 vertical-align: bottom; 40 width: 1em; 41 height: 0.5em; /* Scale a reference block to match the overridden descen of 50%. */ 42 } 43 44 </style> 45 <!-- 46 The three green rectangles below show ascent, character, and descent sizes 47 from the left. The ascent and descent are overridden by 100% and 50% of the 48 specified font size, respectively. The test applies font-size-adjust and font 49 metric overrides simultaneously to text. As we double the text size with 50 font-size-adjust, the ascent and descent override should scale accordingly 51 to double their size. 52 --> 53 <div class="size-adjusted"> 54 <span class="overridden-ascent-ref"></span>X<span class="overridden-descent-ref"></span> 55 </div>