@@ -145,7 +145,7 @@ Issue(5892):
145145
146146<h3 id="font-metrics-override-desc">
147147Default 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'>
151151Name : ascent-override
@@ -168,19 +168,74 @@ For: @font-face
168168Initial : 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
175184When the descriptor value is 'normal' , the corresponding metric value is obtained as-if the
176185descriptor was absent from the <code> @font-face</code> block.
177186
178187Note: User agents may draw data from different places from the font file as the metric values,
179188which 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
182192given 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+ advance from one <a>typographic character unit</a> to the next 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+
207+ <div class="example">
208+ Consider the following content:
209+
210+ <xmp>
211+ @font-face {
212+ font-family: "MyHelvetica";
213+ src: local("Helvetica");
214+ }
215+ ...
216+ <div style="font: 96px 'MyHelvetica';"> Ha</div>
217+ </xmp>
218+ This image shows each glyph's local origin, and the natural advance between them:
219+ <figure>
220+ <img alt="Natural advance of Helvetica glyphs" src="images/Helvetica Natural Advance.png" width="147" height="114">
221+ </figure>
222+ In this example, the natural advance is 69.328125 pixels.
223+
224+ However, if we modify the content as such:
225+ <pre>
226+ @font-face {
227+ font-family: "MyHelvetica";
228+ src: local("Helvetica");
229+ advance-override: 140%;
230+ }
231+ </pre>
232+ The rendering will look like this:
233+ <figure>
234+ <img alt="Overridden advance of Helvetica glyphs" src="images/Helvetica Overridden Advance.png" width="176" height="112">
235+ </figure>
236+ In this example, the used advance between the glyphs is 69.328125 pixels * 1.4 = 97.059375 pixels.
237+ </div>
238+
184239<div class="example">
185240 The percentage is resolved against different font sizes for different elements.
186241
@@ -220,14 +275,16 @@ given percentage multiplied by the used font size. Negative values are invalid a
220275 ascent-override: 125%;
221276 descent-override: 25%;
222277 line-gap-override: 0%;
278+ advance-override: 109%;
223279}
224280
225281<div style="font-family: cool-web-font, fallback-to-local">Title goes here</div>
226282<img src="https://example.com/largeimage" alt="A large image that you don't want to shift">
227283</pre>
228284
229- The image will not be vertically shifted when the user agent finishes loading and
230- switches to use the web font.
285+ The image will not be shifted as much when the user agent finishes loading and
286+ switches to use the web font (assuming the override values are similar to the web font's
287+ natural metrics).
231288
232289</div>
233290
0 commit comments