Skip to content

Commit caf07a5

Browse files
committed
[css-fonts-5] Specify the advance-override @font-face descriptor
1 parent e67e9d9 commit caf07a5

1 file changed

Lines changed: 31 additions & 6 deletions

File tree

css-fonts-5/Overview.bs

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ Issue(5892):
145145

146146
<h3 id="font-metrics-override-desc">
147147
Default font metrics overriding:
148-
the 'ascent-override', 'descent-override' and 'line-gap-override' descriptors</h3>
148+
the 'ascent-override', 'descent-override', 'line-gap-override', and 'advance-override' descriptors</h3>
149149

150150
<pre class='descdef'>
151151
Name: ascent-override
@@ -168,19 +168,42 @@ For: @font-face
168168
Initial: normal
169169
</pre>
170170

171-
The 'ascent-override', 'descent-override' and 'line-gap-override' descriptors define the
171+
<pre class='descdef'>
172+
Name: advance-override
173+
Value: normal | <<percentage>>
174+
For: @font-face
175+
Initial: normal
176+
</pre>
177+
178+
The 'ascent-override', 'descent-override', and 'line-gap-override' descriptors define the
172179
<a spec="CSS-INLINE-3">ascent metric</a>, <a spec="CSS-INLINE-3">descent metric</a> and
173-
<a spec="CSS-INLINE-3">line gap metric</a> of the font, respectively.
180+
<a spec="CSS-INLINE-3">line gap metric</a> of the font, respectively. The `advance-override`
181+
descriptor adjusts the <dfn export>tracking</dfn> between adjacent
182+
<a spec="CSS-TEXT-3>typographic character units</a>.
174183

175184
When the descriptor value is 'normal', the corresponding metric value is obtained from the
176185
font file directly.
177186

178187
Note: User agents may draw data from different places from the font file as the metric values,
179188
which results in different text layouts.
180189

181-
When the descriptor value is a percentage, the corresponding metric value is resolved as the
190+
For the 'ascent-override', 'descent-override' and 'line-gap-override' descriptors, when the
191+
descriptor value is a percentage, the corresponding metric value is resolved as the
182192
given percentage multiplied by the used font size. Negative values are invalid at parse time.
183193

194+
For the 'advance-override' descriptor, when the descriptor value is a percentage, the
195+
spacing between adjacent <a>typographic character units</a> is multiplied by the percentage.
196+
197+
Note: Using the 'ascent-override', 'descent-override', and 'line-grap-override' descriptors can
198+
achieve a similar effect as specifying a percentage for 'line-height' property. Also, using the
199+
'advance-override' has a similar effect as using the 'letter-spacing' property. However,
200+
contrary to 'letter-spacing', 'advance-override' scales the spacing, rather than adding a
201+
constant to the spacing.
202+
203+
Note: 'ascent-override', 'descent-override', 'line-gap-override', and 'advance-override'
204+
are applied per-font rather than per-element. Multiple fonts may be used
205+
within an individual element e.g. for characters not supported by the primary font.
206+
184207
<div class="example">
185208
The percentage is resolved against different font sizes for different elements.
186209

@@ -220,14 +243,16 @@ given percentage multiplied by the used font size. Negative values are invalid a
220243
ascent-override: 125%;
221244
descent-override: 25%;
222245
line-gap-override: 0%;
246+
advance-override: 109%;
223247
}
224248

225249
&lt;div style="font-family: cool-web-font, fallback-to-local"&gt;Title goes here&lt;/div&gt;
226250
&lt;img src="https://example.com/largeimage" alt="A large image that you don't want to shift"&gt;
227251
</pre>
228252

229-
The image will not be vertically shifted when the user agent finishes loading and
230-
switches to use the web font.
253+
The image will not be shifted as much when the user agent finishes loading and
254+
switches to use the web font (assuming the override values are similar to the web font's
255+
natural metrics).
231256

232257
</div>
233258

0 commit comments

Comments
 (0)