@@ -2947,27 +2947,52 @@ When the descriptor value is a percentage, the corresponding metric value is res
29472947given percentage multiplied by the used font size. Negative values are invalid at parse time.
29482948
29492949<div class="example">
2950- We may override the metrics of Arial as follows:
2950+ The percentage is resolved against different font sizes for different elements.
29512951
2952- <pre> @font-face {
2953- font-family: arial;
2954- src: local(Arial), url("http://example.com/arial.woff");
2955- ascent-override: 80%;
2956- descent-override: 20%;
2957- line-gap-override: 0%;
2952+ <pre>
2953+ @font-face {
2954+ font-family: overridden-font;
2955+ ascent-override: 50%;
2956+ ...
29582957}
2958+
2959+ <span style="font-family: overridden-font; font-size: 20px;">
2960+ Outer span content
2961+ <span style="font-size: 150%;">Inner span content</span>
2962+ </span>
29592963</pre>
29602964
2961- Then for an element with the following style:
2965+ The outer span uses an <a spec="CSS-INLINE-3" lt="ascent metric">ascent</a> value of
2966+ 10px, whereas the inner span uses 15px.
2967+
2968+ </div>
2969+
2970+ <div class="example">
2971+ We may override the metrics of a local fallback font to match the primary font, which
2972+ is a web font. This reduces layout shifting when switching from fallback to the
2973+ primary font.
29622974
29632975<pre>
2964- font-family: arial;
2965- font-size: 20px;
2966- line-height: normal;
2976+ @font-face {
2977+ font-family: cool-web-font;
2978+ src: url("https://example.com/font.woff");
2979+ }
2980+
2981+ @font-face {
2982+ font-family: fallback-to-local;
2983+ src: local(Some Local Font);
2984+ /* Override metric values to match cool-web-font */
2985+ ascent-override: 125%;
2986+ descent-override: 25%;
2987+ line-gap-override: 0%;
2988+ }
2989+
2990+ <div style="font-family: cool-web-font, fallback-to-local">Title goes here</div>
2991+ <img src="https://example.com/largeimage" alt="A large image that you don't want to shift">
29672992</pre>
29682993
2969- Each line box will be exactly 20px high. Text baseline will be positioned at 16px
2970- below line box top .
2994+ The image will not be vertically shifted when the user agent finishes loading and
2995+ switches to use the web font .
29712996
29722997</div>
29732998
0 commit comments