forked from w3c/csswg-drafts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOverview.bs
More file actions
375 lines (275 loc) · 10.1 KB
/
Overview.bs
File metadata and controls
375 lines (275 loc) · 10.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
<pre class='metadata'>
Title: CSS Fonts Module Level 5
Shortname: css-fonts
Level: 5
Status: ED
Work Status: exploring
Group: CSSWG
ED: https://drafts.csswg.org/css-fonts-5/
TR: https://www.w3.org/TR/css-fonts-5/
!Delta Spec: yes
Editor: Myles C. Maxfield, Apple Inc., mmaxfield@apple.com, w3cid 77180
Editor: Chris Lilley, W3C, http://svgees.us, w3cid 1438
Abstract: This specification defines modifications to the existing <a href="https://drafts.csswg.org/css-fonts-4/">CSS Fonts 4</a> specification along with additional features.
Repository: w3c/csswg-drafts
Inline Github Issues: title
Default Highlight: css
Warning: Not Ready
</pre>
<pre class="link-defaults">
spec:css-color-4; type:property; text:color
spec:css-values; type:value; text:ex
spec:css22; type:value; for:/; text:block
spec:html; type:element; text:font
spec:css-fonts-4; type:descriptor; text:font-language-override
</pre>
<h2 id="introduction">
Introduction</h2>
The CSS Fonts Level 4 specification ([[!CSS-FONTS-4]]) describes the
controls CSS provides for selecting and using fonts within documents,
including support for variable fonts and color fonts.
The ideas here are additions or modifications to the properties and
rules defined in CSS Fonts Level 4.
This specification is currently a delta to the CSS Fonts Level 4 specification.
Do not assume that if something is not here, it has been dropped.
<h3 id="values">
Value Definitions</h3>
This specification follows the <a href="https://www.w3.org/TR/CSS2/about.html#property-defs">CSS property definition conventions</a> from [[!CSS2]]
using the <a href="https://www.w3.org/TR/css-values-3/#value-defs">value definition syntax</a> from [[!CSS-VALUES-3]].
Value types not defined in this specification are defined in CSS Values & Units [[!CSS-VALUES-3]].
Combination with other CSS modules may expand the definitions of these value types.
In addition to the property-specific values listed in their definitions,
all properties defined in this specification
also accept the <a>CSS-wide keywords</a> as their property value.
For readability they have not been repeated explicitly.
<h2 id="basic-font-props">
Basic Font Properties</h2>
Issue(126):
<h3 id="font-family-prop">
Font family: the 'font-family!!property' property</h3>
<h4 id="generic-font-families">
Generic font families</h4>
In addition to the [[css-fonts-4#generic-font-families]]
in CSS Fonts Level 4, the following new generic font families are also defined.
Issue(4910):
Issue(5054):
<dl dfn-for="font-family,<generic-family>" dfn-type=value>
<dt id="xxx-def"><dfn>xxx</dfn>
<dd>
Placeholder text for the xxx generic font family.
</dl>
Issue(4566):
<h3 id="font-weight-prop">Font weight: the 'font-weight!!property' property</h3>
Issue(2690):
<h3 id="font-style-prop">
Font style: the 'font-style!!property' property</h3>
Issue(4044):
<h3 id="font-size-adjust-prop">
Relative sizing: the 'font-size-adjust' property</h3>
Issue(5539):
<h2 id="font-resources">
Font Resources</h2>
<h3 id="font-face-rule">
The <dfn id="at-font-face-rule">''@font-face''</dfn> rule</h3>
Issue(5518):
<h3 id="font-size-desc">
Font property descriptors: the 'font-size!!descriptor'
</h3>
Issue(806):
Issue(731):
Issue(5892):
<pre class='descdef'>
Name: font-size
Value: auto | [<<number>>]#
Initial: normal
For: @font-face
</pre>
<dl dfn-type="value" dfn-for="@font-face/font-size">
<dt><dfn>auto</dfn></dt>
<dd>
The font matches any font size
</dd>
<dt><dfn><<number>></dfn></dt>
<dd>
If a single <<number>> is given
the font matches that specific font size, only.
If two <<number>>s are given,
they specify a range of font sizes which will match.
</dd>
</dl>
<!-- should this stay in Fonts 4 or be here in Fonts 5? -->
<h3 id="font-metrics-override-desc">
Default font metrics overriding:
the 'ascent-override', 'descent-override', 'line-gap-override', and 'advance-override' descriptors</h3>
<pre class='descdef'>
Name: ascent-override
Value: normal | <<percentage>>
For: @font-face
Initial: normal
</pre>
<pre class='descdef'>
Name: descent-override
Value: normal | <<percentage>>
For: @font-face
Initial: normal
</pre>
<pre class='descdef'>
Name: line-gap-override
Value: normal | <<percentage>>
For: @font-face
Initial: normal
</pre>
<pre class='descdef'>
Name: advance-override
Value: normal | <<percentage>>
For: @font-face
Initial: normal
</pre>
The 'ascent-override', 'descent-override', and 'line-gap-override' descriptors define the
<a spec="CSS-INLINE-3">ascent metric</a>, <a spec="CSS-INLINE-3">descent metric</a> and
<a spec="CSS-INLINE-3">line gap metric</a> of the font, respectively. The 'advance-override'
descriptor adjusts the <dfn export>tracking</dfn> between adjacent
<a spec="CSS-TEXT-3">typographic character units</a>.
When the descriptor value is 'normal', the corresponding metric value is obtained from the
font file directly.
Note: User agents may draw data from different places from the font file as the metric values,
which results in different text layouts.
For the 'ascent-override', 'descent-override' and 'line-gap-override' descriptors, when the
descriptor value is a percentage, the corresponding metric value is resolved as the
given percentage multiplied by the used font size. Negative values are invalid at parse time.
For the 'advance-override' descriptor, when the descriptor value is a percentage, the
advance from one <a>typographic character unit</a> to the next is multiplied by the percentage.
Note: Using the 'ascent-override', 'descent-override', and 'line-grap-override' descriptors can
achieve a similar effect as specifying a percentage for 'line-height' property. Also, using the
'advance-override' has a similar effect as using the 'letter-spacing' property. However,
contrary to 'letter-spacing', 'advance-override' scales the spacing, rather than adding a
constant to the spacing.
Note: 'ascent-override', 'descent-override', 'line-gap-override', and 'advance-override'
are applied per-font rather than per-element. Multiple fonts may be used
within an individual element e.g. for characters not supported by the primary font.
<div class="example">
Consider the following content:
<xmp>
@font-face {
font-family: "MyHelvetica";
src: local("Helvetica");
}
...
<div style="font: 96px 'MyHelvetica';">Ha</div>
</xmp>
This image shows each glyph's local origin, and the natural advance between them:
<figure>
<img alt="Natural advance of Helvetica glyphs" src="images/Helvetica Natural Advance.png" width="147" height="114">
</figure>
In this example, the natural advance is 69.328125 pixels.
However, if we modify the content as such:
<pre>
@font-face {
font-family: "MyHelvetica";
src: local("Helvetica");
advance-override: 140%;
}
</pre>
The rendering will look like this:
<figure>
<img alt="Overridden advance of Helvetica glyphs" src="images/Helvetica Overridden Advance.png" width="176" height="112">
</figure>
In this example, the used advance between the glyphs is 69.328125 pixels * 1.4 = 97.059375 pixels.
</div>
<div class="example">
The percentage is resolved against different font sizes for different elements.
<pre>
@font-face {
font-family: overridden-font;
ascent-override: 50%;
...
}
<span style="font-family: overridden-font; font-size: 20px;">
Outer span content
<span style="font-size: 150%;">Inner span content</span>
</span>
</pre>
The outer span uses an <a spec="CSS-INLINE-3" lt="ascent metric">ascent</a> value of
10px, whereas the inner span uses 15px.
</div>
<div class="example">
We may override the metrics of a local fallback font to match the primary font, which
is a web font. This reduces layout shifting when switching from fallback to the
primary font.
<pre>
@font-face {
font-family: cool-web-font;
src: url("https://example.com/font.woff");
}
@font-face {
font-family: fallback-to-local;
src: local(Some Local Font);
/* Override metric values to match cool-web-font */
ascent-override: 125%;
descent-override: 25%;
line-gap-override: 0%;
advance-override: 109%;
}
<div style="font-family: cool-web-font, fallback-to-local">Title goes here</div>
<img src="https://example.com/largeimage" alt="A large image that you don't want to shift">
</pre>
The image will not be shifted as much when the user agent finishes loading and
switches to use the web font (assuming the override values are similar to the web font's
natural metrics).
</div>
<h3 id="font-sup-sub-override-desc">
Default font metrics overriding:
the 'superscript-position-override', 'subscript-position-override','superscript-size-override' and 'subscript-size-override' descriptors</h3>
Issue(5518):
<pre class='descdef'>
Name: superscript-position-override
Value: normal | <<percentage>>
For: @font-face
Initial: normal
</pre>
<pre class='descdef'>
Name: subscript-position-override
Value: normal | <<percentage>>
For: @font-face
Initial: normal
</pre>
<pre class='descdef'>
Name: superscript-size-override
Value: normal | <<percentage>>
For: @font-face
Initial: normal
</pre>
<pre class='descdef'>
Name: subscript-size-override
Value: normal | <<percentage>>
For: @font-face
Initial: normal
</pre>
<h2 id="font-rend-props">
Font Feature Properties</h2>
<h3 id="font-language-override-prop">Font language override: the 'font-language-override' property</h3>
Issue(5484):
<h2 id="font-feature-variation-resolution">
Font Feature and Variation Resolution</h3>
Issue(5635):
<h2 id="font-variation-props">
Font Variation Properties</h2>
<h3 id="font-optical-sizing-def">
Optical sizing control: the 'font-optical-sizing' property</h3>
Issue(5466):
<!-- This might get moved here -->
<!--
<h2 id="color-font-support">
Color Font Support</h2>
-->
<h2 id="priv-sec">
Security and Privacy Considerations
</h2>
No new security or privacy considerations have been raised on this specification.
<h2 id="acknowledgments">
Acknowledgments</h2>
The CSS Working group would like to thank:
<h2 id="changes">
Changes
</h2>
-->