Skip to content

Commit a6e10d5

Browse files
committed
Add example for advance-override
1 parent 8cd3dd9 commit a6e10d5

3 files changed

Lines changed: 34 additions & 2 deletions

File tree

css-fonts-5/Overview.bs

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,9 @@ Initial: normal
177177

178178
The 'ascent-override', 'descent-override', and 'line-gap-override' descriptors define the
179179
<a spec="CSS-INLINE-3">ascent metric</a>, <a spec="CSS-INLINE-3">descent metric</a> and
180-
<a spec="CSS-INLINE-3">line gap metric</a> of the font, respectively. The `advance-override`
180+
<a spec="CSS-INLINE-3">line gap metric</a> of the font, respectively. The 'advance-override'
181181
descriptor adjusts the <dfn export>tracking</dfn> between adjacent
182-
<a spec="CSS-TEXT-3>typographic character units</a>.
182+
<a spec="CSS-TEXT-3">typographic character units</a>.
183183

184184
When the descriptor value is 'normal', the corresponding metric value is obtained from the
185185
font file directly.
@@ -204,6 +204,38 @@ Note: 'ascent-override', 'descent-override', 'line-gap-override', and 'advance-o
204204
are applied per-font rather than per-element. Multiple fonts may be used
205205
within an individual element e.g. for characters not supported by the primary font.
206206

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+
207239
<div class="example">
208240
The percentage is resolved against different font sizes for different elements.
209241

35.7 KB
Loading
38.4 KB
Loading

0 commit comments

Comments
 (0)