-
Notifications
You must be signed in to change notification settings - Fork 708
/
Copy pathOverview.bs
390 lines (294 loc) · 11.2 KB
/
Overview.bs
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
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
<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>
The 'font-size-adjust' property is applied after the 'size-adjust' descriptor.
Note: The consequence of applying 'font-size-adjust' after 'size-adjust' is that
'size-adjust' appears to have no effect.
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>
Note: Descriptors are applied per-font rather than per-element.
Multiple fonts can be used within an individual element
e.g. for characters not supported by the [=first available font=].
<h3 id="font-size-desc">
Font property descriptors: the 'font-size!!descriptor'
</h3>
Issue(806):
Issue(731):
<pre class='descdef'>
Name: font-size
Value: auto | [<<number>>]{1,2}
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>
<h3 id="size-adjust-desc">
Glyph Size Multiplier:
the 'size-adjust' descriptor</h3>
<pre class='descdef'>
Name: size-adjust
Value: <<percentage [0,Infinity]>>
For: @font-face
Initial: 100%
</pre>
The 'size-adjust' descriptor defines a multiplier
for glyph outlines and metrics associated with this font,
to allow the author to harmonize the designs of various fonts
when rendered at the same 'font-size'.
All metrics associated with this font--
including glyph advances, baseline tables, and overrides provided by ''@font-face'' descriptors--
are scaled by the given percentage,
as are the rendered glyph images.
Consequently,
any values derived from font metrics
(such as ''ex'' and ''ch'' units,
or the ''text-underline-thickness/from-font'' value of 'text-underline-thickness')
are also affected when sourced from this font.
However, the [=computed value|computed=] 'font-size'
(and thus any values that derive from it,
such as ''em'' units, percentages in 'text-underline-offset', etc.)
remains unaffected.
Note: The 'size-adjust' descriptor functions similarly to
the 'font-size-adjust' property,
which essentially calculates an adjustment per font by matching ex heights,
but likewise does not affect the [=computed value|computed=] 'font-size'.
<!-- should this stay in Fonts 4 or be here in Fonts 5? -->
<h3 id="font-metrics-override-desc">
Line Height Font Metrics Overrides:
the 'ascent-override', 'descent-override', and 'line-gap-override' descriptors</h3>
<pre class='descdef'>
Name: ascent-override
Value: normal | <<percentage [0,Infinity]>>
For: @font-face
Initial: normal
</pre>
<pre class='descdef'>
Name: descent-override
Value: normal | <<percentage [0,Infinity]>>
For: @font-face
Initial: normal
</pre>
<pre class='descdef'>
Name: line-gap-override
Value: normal | <<percentage [0,Infinity]>>
For: @font-face
Initial: normal
</pre>
The 'ascent-override', 'descent-override', and 'line-gap-override' descriptors specify 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.
<dl dfn-for="ascent-override!!descriptor,descent-override!!descriptor,line-gap-override!!descriptor" dfn-type=value>
<dt><dfn>normal</dfn>
<dd>
The corresponding metric value is obtained from the font as usual,
as if this descriptor were absent from the <code>@font-face</code> block.
Note: Since there are multiple sources of such metrics in some font formats,
this can result in text layout that varies across UAs/platforms.
<dt><dfn><<percentage>></dfn>
<dd>
The corresponding metric is replaced by
the given percentage multiplied by the used font size.
</dl>
The 'font-size-adjust' property is applied after the 'size-adjust' descriptor.
Note: The consequence of applying 'font-size-adjust' after 'size-adjust' is that
'size-adjust' appears to have no effect.
Note: None of these descriptors affect the [=computed value|computation=] of
'font-size', 'line-height', or [=font-relative lengths=].
They can, however, affect the behavior of ''line-height: normal''
and more generally the baseline alignment of [=inline-level=] content.
<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%;
size-adjust: 96%;
}
<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">
Superscript and subscript metrics overrides:
the 'superscript-position-override', 'subscript-position-override','superscript-size-override' and 'subscript-size-override' descriptors</h3>
<pre class='descdef'>
Name: superscript-position-override
Value: auto | from-font | <<percentage>>
For: @font-face
Initial: normal
</pre>
<pre class='descdef'>
Name: subscript-position-override
Value: auto | from-font | <<percentage>>
For: @font-face
Initial: normal
</pre>
<pre class='descdef'>
Name: superscript-size-override
Value: auto | from-font | <<percentage [0,Infinity]>>
For: @font-face
Initial: normal
</pre>
<pre class='descdef'>
Name: subscript-size-override
Value: auto | from-font | <<percentage [0,Infinity]>>
For: @font-face
Initial: normal
</pre>
The 'superscript-position-override', 'subscript-position-override',
'superscript-size-override', and 'subscript-size-override' descriptors
specify the superscript offset, subscript offset, superscript size, and subscript size
metrics of the font, respectively,
which are used to synthesize glyphs when required by 'font-variant-position'.
<dl dfn-for="superscript-position-override!!descriptor,subscript-position-override!!descriptor,superscript-size-override!!descriptor,subscript-size-override!!descriptor" dfn-type=value>
<dt><dfn>auto</dfn>
<dd>
The UA determines what metrics value to use,
whether derived from the font or from some heuristic.
<dt><dfn>from-font</dfn>
<dd>
The corresponding metric in the font data is used, if any.
(If the metric is missing, same as ''superscript-position-override/auto''.)
<dt><dfn><<percentage>></dfn>
<dd>
The corresponding metric is replaced by
the given percentage multiplied by the used font size.
</dl>
<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>
-->