-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathindex.html
More file actions
885 lines (871 loc) · 53.5 KB
/
Copy pathindex.html
File metadata and controls
885 lines (871 loc) · 53.5 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
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
<!doctype html><html lang="en">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>CSS Font Display Controls Module Level 1</title>
<meta content="width=device-width, initial-scale=1, shrink-to-fit=no" name="viewport">
<meta content="abandoned" name="csswg-work-status">
<meta content="UD" name="w3c-status">
<meta content="This spec introduces a new ''@font-face'' descriptor for controlling how a downloadable font renders before it is fully loaded. It's intended that this spec be merged into the Fonts spec, likely Fonts Level 4." name="abstract">
<link href="../default.css" rel="stylesheet" type="text/css">
<link href="../csslogo.ico" rel="shortcut icon" type="image/x-icon">
<link href="https://www.w3.org/StyleSheets/TR/2016/W3C-UD" rel="stylesheet" type="text/css">
<meta content="Bikeshed version 090ef96cbce74475c89e94394cc8fa4fbc08b477" name="generator">
<link href="https://tabatkins.github.io/specs/css-font-display/" rel="canonical">
<meta content="8319b98371b51c91f9bcdaf90e2b28b348351e23" name="document-revision">
<style>/* style-md-lists */
/* This is a weird hack for me not yet following the commonmark spec
regarding paragraph and lists. */
[data-md] > :first-child {
margin-top: 0;
}
[data-md] > :last-child {
margin-bottom: 0;
}</style>
<style>/* style-counters */
body {
counter-reset: example figure issue;
}
.issue {
counter-increment: issue;
}
.issue:not(.no-marker)::before {
content: "Issue " counter(issue);
}
.example {
counter-increment: example;
}
.example:not(.no-marker)::before {
content: "Example " counter(example);
}
.invalid.example:not(.no-marker)::before,
.illegal.example:not(.no-marker)::before {
content: "Invalid Example" counter(example);
}
figcaption {
counter-increment: figure;
}
figcaption:not(.no-marker)::before {
content: "Figure " counter(figure) " ";
}</style>
<style>/* style-dfn-panel */
.dfn-panel {
position: absolute;
z-index: 35;
height: auto;
width: -webkit-fit-content;
width: fit-content;
max-width: 300px;
max-height: 500px;
overflow: auto;
padding: 0.5em 0.75em;
font: small Helvetica Neue, sans-serif, Droid Sans Fallback;
background: #DDDDDD;
color: black;
border: outset 0.2em;
}
.dfn-panel:not(.on) { display: none; }
.dfn-panel * { margin: 0; padding: 0; text-indent: 0; }
.dfn-panel > b { display: block; }
.dfn-panel a { color: black; }
.dfn-panel a:not(:hover) { text-decoration: none !important; border-bottom: none !important; }
.dfn-panel > b + b { margin-top: 0.25em; }
.dfn-panel ul { padding: 0; }
.dfn-panel li { list-style: inside; }
.dfn-panel.activated {
display: inline-block;
position: fixed;
left: .5em;
bottom: 2em;
margin: 0 auto;
max-width: calc(100vw - 1.5em - .4em - .5em);
max-height: 30vh;
}
.dfn-paneled { cursor: pointer; }
</style>
<style>/* style-selflinks */
.heading, .issue, .note, .example, li, dt {
position: relative;
}
a.self-link {
position: absolute;
top: 0;
left: calc(-1 * (3.5rem - 26px));
width: calc(3.5rem - 26px);
height: 2em;
text-align: center;
border: none;
transition: opacity .2s;
opacity: .5;
}
a.self-link:hover {
opacity: 1;
}
.heading > a.self-link {
font-size: 83%;
}
li > a.self-link {
left: calc(-1 * (3.5rem - 26px) - 2em);
}
dfn > a.self-link {
top: auto;
left: auto;
opacity: 0;
width: 1.5em;
height: 1.5em;
background: gray;
color: white;
font-style: normal;
transition: opacity .2s, background-color .2s, color .2s;
}
dfn:hover > a.self-link {
opacity: 1;
}
dfn > a.self-link:hover {
color: black;
}
a.self-link::before { content: "¶"; }
.heading > a.self-link::before { content: "§"; }
dfn > a.self-link::before { content: "#"; }</style>
<style>/* style-autolinks */
.css.css, .property.property, .descriptor.descriptor {
color: #005a9c;
font-size: inherit;
font-family: inherit;
}
.css::before, .property::before, .descriptor::before {
content: "���";
}
.css::after, .property::after, .descriptor::after {
content: "’";
}
.property, .descriptor {
/* Don't wrap property and descriptor names */
white-space: nowrap;
}
.type { /* CSS value <type> */
font-style: italic;
}
pre .property::before, pre .property::after {
content: "";
}
[data-link-type="property"]::before,
[data-link-type="propdesc"]::before,
[data-link-type="descriptor"]::before,
[data-link-type="value"]::before,
[data-link-type="function"]::before,
[data-link-type="at-rule"]::before,
[data-link-type="selector"]::before,
[data-link-type="maybe"]::before {
content: "‘";
}
[data-link-type="property"]::after,
[data-link-type="propdesc"]::after,
[data-link-type="descriptor"]::after,
[data-link-type="value"]::after,
[data-link-type="function"]::after,
[data-link-type="at-rule"]::after,
[data-link-type="selector"]::after,
[data-link-type="maybe"]::after {
content: "’";
}
[data-link-type].production::before,
[data-link-type].production::after,
.prod [data-link-type]::before,
.prod [data-link-type]::after {
content: "";
}
[data-link-type=element],
[data-link-type=element-attr] {
font-family: Menlo, Consolas, "DejaVu Sans Mono", monospace;
font-size: .9em;
}
[data-link-type=element]::before { content: "<" }
[data-link-type=element]::after { content: ">" }
[data-link-type=biblio] {
white-space: pre;
}</style>
<body class="h-entry">
<div class="head">
<p data-fill-with="logo"><a class="logo" href="https://www.w3.org/"> <img alt="W3C" height="48" src="https://www.w3.org/StyleSheets/TR/2016/logos/W3C" width="72"> </a> </p>
<h1 class="p-name no-ref" id="title">CSS Font Display Controls Module Level 1</h1>
<h2 class="no-num no-toc no-ref heading settled" id="subtitle"><span class="content">Unofficial Proposal Draft, <time class="dt-updated" datetime="2018-09-14">14 September 2018</time></span></h2>
<div data-fill-with="spec-metadata">
<dl>
<dt>This version:
<dd><a class="u-url" href="https://tabatkins.github.io/specs/css-font-display/">https://tabatkins.github.io/specs/css-font-display/</a>
<dt>Issue Tracking:
<dd><a href="#issues-index">Inline In Spec</a>
<dd><a href="https://github.com/w3c/csswg-drafts/labels/css-font-display-1">GitHub Issues</a>
<dt class="editor">Editors:
<dd class="editor p-author h-card vcard"><a class="p-name fn u-url url" href="http://xanthir.com">Tab Atkins</a> (<span class="p-org org">Google</span>)
<dd class="editor p-author h-card vcard"><span class="p-name fn">Kenji Baheux</span> (<span class="p-org org">Google</span>)
<dt>Suggest an Edit for this Spec:
<dd><a href="https://github.com/w3c/csswg-drafts/blob/master/css-font-display-1/Overview.bs">GitHub Editor</a>
</dl>
</div>
<div data-fill-with="warning">
<details class="annoying-warning" open>
<summary>This Document Is Obsolete and Has Been Replaced</summary>
<p> This specification is obsolete and has been replaced by the document at <a href="https://drafts.csswg.org/css-fonts-4/#font-display-desc">https://drafts.csswg.org/css-fonts-4/#font-display-desc</a>.
Do not attempt to implement this specification.
Do not refer to this specification except as a historical artifact. </p>
</details>
</div>
<p class="copyright" data-fill-with="copyright"><a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2018 <a href="http://www.w3.org/"><abbr title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup> (<a href="http://www.csail.mit.edu/"><abbr title="Massachusetts Institute of Technology">MIT</abbr></a>, <a href="http://www.ercim.eu/"><abbr title="European Research Consortium for Informatics and Mathematics">ERCIM</abbr></a>, <a href="http://www.keio.ac.jp/">Keio</a>, <a href="http://ev.buaa.edu.cn/">Beihang</a>). W3C <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>, <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and <a href="http://www.w3.org/Consortium/Legal/2015/copyright-software-and-document">permissive document license</a> rules apply. </p>
<hr title="Separator for header">
</div>
<div class="p-summary" data-fill-with="abstract">
<h2 class="no-num no-toc no-ref heading settled" id="abstract"><span class="content">Abstract</span></h2>
<p>This spec introduces a new <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-fonts-4/#at-font-face-rule" id="ref-for-at-font-face-rule">@font-face</a> descriptor for controlling how a downloadable font renders before it is fully loaded. It’s intended that this spec be merged into the Fonts spec, likely Fonts Level 4.</p>
<a href="http://www.w3.org/TR/CSS/">CSS</a> is a language for describing the rendering of structured documents
(such as HTML and XML)
on screen, on paper, in speech, etc.
</div>
<h2 class="no-num no-toc no-ref heading settled" id="status"><span class="content">Status of this document</span></h2>
<div data-fill-with="status">
<p></p>
</div>
<div data-fill-with="at-risk"></div>
<nav data-fill-with="table-of-contents" id="toc">
<h2 class="no-num no-toc no-ref" id="contents">Table of Contents</h2>
<ol class="toc" role="directory">
<li><a href="#intro"><span class="secno">1</span> <span class="content">Introduction</span></a>
<li><a href="#timeline"><span class="secno">2</span> <span class="content">The Font Display Timeline</span></a>
<li><a href="#font-display-desc"><span class="secno">3</span> <span class="content">Controlling Font Display Per Font-Face: the <span class="css">font-display</span> descriptor</span></a>
<li><a href="#controlling-font-display-per-font-family-via-font-feature-values"><span class="secno">4</span> <span class="content">Controlling Font Display Per Font-Family via <span class="css">@font-feature-values</span></span></a>
<li><a href="#acks"><span class="secno">5</span> <span class="content">Acknowledgements</span></a>
<li>
<a href="#conformance"><span class="secno"></span> <span class="content"> Conformance</span></a>
<ol class="toc">
<li><a href="#document-conventions"><span class="secno"></span> <span class="content"> Document conventions</span></a>
<li><a href="#conform-classes"><span class="secno"></span> <span class="content"> Conformance classes</span></a>
<li>
<a href="#conform-responsible"><span class="secno"></span> <span class="content"> Requirements for Responsible Implementation of CSS</span></a>
<ol class="toc">
<li><a href="#conform-partial"><span class="secno"></span> <span class="content"> Partial Implementations</span></a>
<li><a href="#conform-future-proofing"><span class="secno"></span> <span class="content"> Implementations of Unstable and Proprietary Features</span></a>
<li><a href="#conform-testing"><span class="secno"></span> <span class="content"> Implementations of CR-level Features</span></a>
</ol>
</ol>
<li>
<a href="#index"><span class="secno"></span> <span class="content">Index</span></a>
<ol class="toc">
<li><a href="#index-defined-here"><span class="secno"></span> <span class="content">Terms defined by this specification</span></a>
<li><a href="#index-defined-elsewhere"><span class="secno"></span> <span class="content">Terms defined by reference</span></a>
</ol>
<li>
<a href="#references"><span class="secno"></span> <span class="content">References</span></a>
<ol class="toc">
<li><a href="#normative"><span class="secno"></span> <span class="content">Normative References</span></a>
<li><a href="#informative"><span class="secno"></span> <span class="content">Informative References</span></a>
</ol>
<li>
<a href="#property-index"><span class="secno"></span> <span class="content">Property Index</span></a>
<ol class="toc">
<li><a href="#font-face-descriptor-table"><span class="secno"></span> <span class="content"><span>@font-face</span> Descriptors</span></a>
<li><a href="#font-feature-values-descriptor-table"><span class="secno"></span> <span class="content"><span>@font-feature-values</span> Descriptors</span></a>
</ol>
<li><a href="#issues-index"><span class="secno"></span> <span class="content">Issues Index</span></a>
</ol>
</nav>
<main>
<h2 class="heading settled" data-level="1" id="intro"><span class="secno">1. </span><span class="content">Introduction</span><a class="self-link" href="#intro"></a></h2>
<p>When using downloadable webfonts via <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-fonts-4/#at-font-face-rule" id="ref-for-at-font-face-rule①">@font-face</a>,
the user agent needs to know what to do while the font is actively loading.
Most web browsers have adopted some form of timeout:</p>
<table class="data">
<thead>
<tr>
<th>Browser
<th>Timeout
<th>Fallback
<th>Swap
<tbody>
<tr>
<th>Chrome 35+
<td>3 seconds
<td>yes
<td>yes
<tr>
<th>Opera
<td>3 seconds
<td>yes
<td>yes
<tr>
<th>Firefox
<td>3 seconds
<td>yes
<td>yes
<tr>
<th>Internet Explorer
<td>0 seconds
<td>yes
<td>yes
<tr>
<th>Safari
<td>3 seconds
<td>yes
<td>yes
</table>
<ul>
<li data-md>
<p>Chrome and Firefox have a 3 second timeout after which the text is shown with the fallback font.
Eventually, a swap occurs:
the text is re-rendered with the intended font once it becomes available.</p>
<li data-md>
<p>Internet Explorer has a 0 second timeout which results in immediate text rendering:
if the requested font is not yet available,
fallback is used,
and text is rerendered later once the requested font becomes available.</p>
</ul>
<p>While these default behaviors are reasonable,
they’re unfortunately inconsistent across browsers.
Worse, no single approach is sufficient to cover the range of use-cases
required by modern user-experience– and performance–conscious applications.</p>
<p>The Font Loading API <a data-link-type="biblio" href="#biblio-css-font-loading-3">[CSS-FONT-LOADING-3]</a> allows a developer to override some of the above behaviors,
but that requires scripting,
a non-trivial amount of effort,
and ultimately doesn’t provide sufficient hooks to cover <em>all</em> reasonable cases.
Additionally,
the developer needs to either inline the loading script into their page
or load an external library,
introducing additional network latency before the fonts can be loaded
and delaying text rendering.</p>
<p>Design/performance-conscious web developers have a good sense for the relative importance of a given web font for the intended user experience.
This specification provides them the ability to control font timeout and rendering behavior.
Specifically, it lets developers:</p>
<ul>
<li data-md>
<p>Define the font display policy when text is ready to be painted: block, or paint with fallback.</p>
<li data-md>
<p>Define the font display policy once the desired font is available: rerender text with the new font, or leave it with the fallback.</p>
<li data-md>
<p>Define custom timeout values for each font.</p>
<li data-md>
<p>Define custom display and timeout policies per element.</p>
</ul>
<h2 class="heading settled" data-level="2" id="timeline"><span class="secno">2. </span><span class="content">The Font Display Timeline</span><a class="self-link" href="#timeline"></a></h2>
<p>At the moment the user agent first attempts to use a given downloaded font face on a page,
the font face’s <dfn data-dfn-type="dfn" data-export data-local-lt="timer" id="font-download-timer">font download timer<a class="self-link" href="#font-download-timer"></a></dfn> is started.
This timer advances through three periods of time associated with the font face—<wbr>the <a data-link-type="dfn" href="#font-block-period" id="ref-for-font-block-period">block period</a>, the <a data-link-type="dfn" href="#font-swap-period" id="ref-for-font-swap-period">swap period</a>, and the <a data-link-type="dfn" href="#font-failure-period" id="ref-for-font-failure-period">failure period</a>—<wbr>which dictate the rendering behavior of any elements using the font face:</p>
<ul>
<li data-md>
<p>The first period is the <dfn class="dfn-paneled" data-dfn-type="dfn" data-export data-local-lt="block period" id="font-block-period">font block period</dfn>.
During this period,
if the font face is not loaded,
any element attempting to use it must instead <a data-link-type="dfn" href="#render-with-an-invisible-fallback-font-face" id="ref-for-render-with-an-invisible-fallback-font-face">render with an invisible fallback font face</a>.
If the font face successfully loads during the <a data-link-type="dfn" href="#font-block-period" id="ref-for-font-block-period①">block period</a>,
the font face is then used normally.</p>
<li data-md>
<p>The second period, occuring immediately after the <a data-link-type="dfn" href="#font-block-period" id="ref-for-font-block-period②">block period</a>,
is the <dfn class="dfn-paneled" data-dfn-type="dfn" data-export data-local-lt="swap period" id="font-swap-period">font swap period</dfn>.
During this period,
if the font face is not loaded,
any element attempting to use it must instead <a data-link-type="dfn" href="#render-with-a-fallback-font-face" id="ref-for-render-with-a-fallback-font-face">render with a fallback font face</a>.
If the font face successfully loads during the <a data-link-type="dfn" href="#font-swap-period" id="ref-for-font-swap-period①">swap period</a>,
the font face is then used normally.</p>
<li data-md>
<p>The third period, occuring immediately after the <a data-link-type="dfn" href="#font-swap-period" id="ref-for-font-swap-period②">swap period</a>,
is the <dfn class="dfn-paneled" data-dfn-type="dfn" data-export data-local-lt="failure period" id="font-failure-period">font failure period</dfn>.
If the font face is not yet loaded when this period starts,
it’s marked as a failed load,
causing normal font fallback.
Otherwise, the font face is used normally.</p>
</ul>
<p>To <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="render-with-a-fallback-font-face">render with a fallback font face</dfn> for a given element,
the user agent must find the first font face specified in the element’s <a class="property css" data-link-type="property" href="https://drafts.csswg.org/css-fonts-3/#propdef-font-family" id="ref-for-propdef-font-family">font-family</a> list
which is already loaded,
and use that for rendering text.
Doing this must not trigger loads of any of the fallback fonts.</p>
<p>To <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="render-with-an-invisible-fallback-font-face">render with an invisible fallback font face</dfn> for a given element,
find a font face as per "<a data-link-type="dfn" href="#render-with-a-fallback-font-face" id="ref-for-render-with-a-fallback-font-face①">render with a fallback font face</a>".
Create an anonymous font face with the same metrics as the selected font face
but with all glyphs "invisible" (containing no "ink"),
and use that for rendering text.
Doing this must not trigger loads of any of the fallback fonts.</p>
<p class="issue" id="issue-160eca9c"><a class="self-link" href="#issue-160eca9c"></a> <a class="css" data-link-type="maybe" href="#valdef-font-face-font-display-fallback" id="ref-for-valdef-font-face-font-display-fallback">fallback</a> and <a class="css" data-link-type="maybe" href="#valdef-font-face-font-display-optional" id="ref-for-valdef-font-face-font-display-optional">optional</a> can result in some faces in a family being used
while others are required to fallback,
giving a "ransom note" look.
Perhaps require that all fonts in a family have the same behavior (all swapped in, or all fallback)?
See also the @font-feature-values for controlling the behavior on a font family basis.</p>
<h2 class="heading settled" data-level="3" id="font-display-desc"><span class="secno">3. </span><span class="content">Controlling Font Display Per Font-Face: the <span class="css">font-display</span> descriptor</span><a class="self-link" href="#font-display-desc"></a></h2>
<p>The <a class="property" data-link-type="propdesc" href="#descdef-font-face-font-display" id="ref-for-descdef-font-face-font-display">font-display</a> descriptor for <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-fonts-4/#at-font-face-rule" id="ref-for-at-font-face-rule②">@font-face</a> determines how a font face is displayed,
based on whether and when it is downloaded and ready to use.</p>
<table class="def descdef">
<tbody>
<tr>
<th>Name:
<td><dfn class="dfn-paneled css" data-dfn-for="@font-face" data-dfn-type="descriptor" data-export id="descdef-font-face-font-display">font-display</dfn>
<tr>
<th>For:
<td><a class="css" data-link-type="at-rule" href="https://drafts.csswg.org/css-fonts-4/#at-font-face-rule" id="ref-for-at-font-face-rule③">@font-face</a>
<tr>
<th>Value:
<td class="prod">auto <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-4/#comb-one" id="ref-for-comb-one">|</a> block <span>|</span> swap <span>|</span> fallback <span>|</span> optional
<tr>
<th>Initial:
<td>auto
</table>
<p class="note" role="note"><span>Note:</span> For all of these values,
user agents may use slightly different durations,
or more sophisticated behaviors that can’t be directly expressed in the <a class="property" data-link-type="propdesc" href="#descdef-font-face-font-display" id="ref-for-descdef-font-face-font-display①">font-display</a> syntax,
in order to provide more useful behavior for their users.
They may also provide the ability for users to override author-chosen behavior
with something more desirable;
for example, forcing all fonts to have a <span class="css">0s</span> <a data-link-type="dfn" href="#font-block-period" id="ref-for-font-block-period③">block period</a>.</p>
<dl>
<dt><dfn class="css" data-dfn-for="@font-face/font-display" data-dfn-type="value" data-export id="valdef-font-face-font-display-auto">auto<a class="self-link" href="#valdef-font-face-font-display-auto"></a></dfn>
<dd>
The font display policy is user-agent-defined.
<p class="note" role="note"><span>Note:</span> Many browsers have a default policy similar to that specified by <span class="css">block</span>.</p>
<dt><dfn class="css" data-dfn-for="@font-face/font-display" data-dfn-type="value" data-export id="valdef-font-face-font-display-block">block<a class="self-link" href="#valdef-font-face-font-display-block"></a></dfn>
<dd>
Gives the font face a short <a data-link-type="dfn" href="#font-block-period" id="ref-for-font-block-period④">block period</a> (<span class="css">3s</span> is recommended in most cases)
and an infinite <a data-link-type="dfn" href="#font-swap-period" id="ref-for-font-swap-period③">swap period</a>.
<p class="note" role="note"><span>Note:</span> In other words, the browser draws "invisible" text at first if it’s not loaded,
but swaps the font face in as soon as it loads.</p>
<p>This value must only be used when rendering text in a particular font is required for the page to be usable.
It must only be used for small pieces of text.</p>
<div class="example" id="example-c34bb1ac">
<a class="self-link" href="#example-c34bb1ac"></a> For example, badly designed "icon fonts" might associate a "⎙" (print) icon
with an unrelated character like "C",
so if the text is displayed with a fallback font instead
there will be confusing letters scattered around the page
rather than the desired icon.
In this case, temporary blank spots are better than using a fallback font.
<p>(However, the fallback font is used <em>eventually</em>,
as having confusing letters scattered around the page
is better than having links and such never show up at all.)</p>
</div>
<dt><dfn class="css" data-dfn-for="@font-face/font-display" data-dfn-type="value" data-export id="valdef-font-face-font-display-swap">swap<a class="self-link" href="#valdef-font-face-font-display-swap"></a></dfn>
<dd>
Gives the font face a <span class="css">0s</span> <a data-link-type="dfn" href="#font-block-period" id="ref-for-font-block-period⑤">block period</a> and an infinite <a data-link-type="dfn" href="#font-swap-period" id="ref-for-font-swap-period④">swap period</a>.
<p class="note" role="note"><span>Note:</span> In other words, the browser draws the text immediately with a fallback if the font face isn’t loaded,
but swaps the font face in as soon as it loads.</p>
<p>This value should only be used when rendering text in a particular font is very important for the page,
but rendering in any font will still get a correct message across.
It should only be used for small pieces of text.</p>
<div class="example" id="example-bc8b70fc"><a class="self-link" href="#example-bc8b70fc"></a> For example,
if a website has a custom font for rendering their logo,
rendering that logo correctly is fairly important for branding purposes,
but displaying the logo in any font will at least get the point across without confusion. </div>
<dt><dfn class="dfn-paneled css" data-dfn-for="@font-face/font-display" data-dfn-type="value" data-export id="valdef-font-face-font-display-fallback">fallback</dfn>
<dd>
Gives the font face an extremely small <a data-link-type="dfn" href="#font-block-period" id="ref-for-font-block-period⑥">block period</a> (<span class="css">100ms</span> or less is recommended in most cases)
and a short <a data-link-type="dfn" href="#font-swap-period" id="ref-for-font-swap-period⑤">swap period</a> (<span class="css">3s</span> is recommended in most cases).
<p class="note" role="note"><span>Note:</span> In other words, the font face is rendered with a fallback at first if it’s not loaded,
but it’s swapped in as soon as it loads.
However, if too much time passes,
the fallback will be used for the rest of the page’s lifetime instead.</p>
<p>This value should be used for body text,
or any other text where the use of the chosen font is useful and desired,
but it’s acceptable for the user to see the text in a fallback font.
This value is appropriate to use for large pieces of text.</p>
<div class="example" id="example-d1362f0c"><a class="self-link" href="#example-d1362f0c"></a> For example,
in large pieces of body text,
it’s most important just to get the text rendered quickly,
so the user can begin to read as quickly as possible.
Further, once the user has started reading,
they shouldn’t be disturbed by the text suddenly "shifting"
as a new font is swapped in,
as that’s distracting and annoying to re-find where one was in the text. </div>
<dt><dfn class="dfn-paneled css" data-dfn-for="@font-face/font-display" data-dfn-type="value" data-export id="valdef-font-face-font-display-optional">optional</dfn>
<dd>
Gives the font face an extremely small <a data-link-type="dfn" href="#font-block-period" id="ref-for-font-block-period⑦">block period</a> (<span class="css">100ms</span> or less is recommended in most cases)
and a <span class="css">0s</span> <a data-link-type="dfn" href="#font-swap-period" id="ref-for-font-swap-period⑥">swap period</a>.
<p>If the font is not retrieved before the two durations expire,
the user agent may choose to abort the font download,
or download it with a very low priority.
If the user agent believes it would be useful for the user,
it may avoid even starting the font download,
and proceed immediately to using a fallback font.</p>
<p class="note" role="note"><span>Note:</span> In other words, the font is used if it’s already downloaded and available,
but otherwise a fallback is used for the rest of the page’s lifetime instead.
The font might download in the background and be available to future page loads,
but if the user-agent detects that the user has very limited bandwidth,
it might choose to simply never download and use the font.</p>
<p>This value should be used for body text,
or any other text where the chosen font is purely a decorative "nice-to-have".
It should be used anytime it is more important that the web page render quickly on first visit,
than it is that the user wait a longer time to see everything perfect immediately.</p>
<div class="example" id="example-72b025b5">
<a class="self-link" href="#example-72b025b5"></a> For example, body text is perfectly readable in one of the browser default fonts,
though a downloadable font face may be more attractive
and mesh with the site’s aesthetics better.
First time visitors to a site generally care far more about the site being quickly usable
than they do about the finer points of its display,
and <a class="css" data-link-type="maybe" href="#valdef-font-face-font-display-optional" id="ref-for-valdef-font-face-font-display-optional①">optional</a> provides a good behavior for them.
If they return later,
the desired font faces might have finished downloading,
giving them the "intended" experience without slowing down
either their first or subsequent visits.
<p>Users on very slow connections might not ever receive the "intended" experience,
but <a class="css" data-link-type="maybe" href="#valdef-font-face-font-display-optional" id="ref-for-valdef-font-face-font-display-optional②">optional</a> ensures they can actually <em>use</em> the site,
rather than quitting and going elsewhere because the site takes too long to load.</p>
</div>
</dl>
<h2 class="heading settled" data-level="4" id="controlling-font-display-per-font-family-via-font-feature-values"><span class="secno">4. </span><span class="content">Controlling Font Display Per Font-Family via <span class="css">@font-feature-values</span></span><a class="self-link" href="#controlling-font-display-per-font-family-via-font-feature-values"></a></h2>
The <a class="property" data-link-type="propdesc" href="#descdef-font-feature-values-font-display" id="ref-for-descdef-font-feature-values-font-display">font-display</a> descriptor for <span class="css">@font-feature-values</span> determines how a font family is displayed, by setting the "default" font-display value for @font-face rules targeting the same font family.
When font-display is omitted in an @font-face rule, the user agent uses the font-display value set via the @font-feature-values/font-display for the relevant font-family if one is set, and otherwise defaults to "font-display: auto".
<p>This mechanism can be used to set a default display policy for an entire font-family, and enables developers to set a display policy for @font-face rules that are not directly under their control.
For example, when a font is served by a third-party font foundry, the developer does not control the @font-face rules but is still able to set a default font-display policy for the provided font-family.
The ability to set a default policy for an entire font-family is also useful to avoid the ransom note effect (i.e. mismatched font faces) because the display policy is then applied to the entire font family.</p>
<table class="def descdef">
<tbody>
<tr>
<th>Name:
<td><dfn class="dfn-paneled css" data-dfn-for="@font-feature-values" data-dfn-type="descriptor" data-export id="descdef-font-feature-values-font-display">font-display</dfn>
<tr>
<th>For:
<td><a class="css" data-link-type="at-rule">@font-feature-values</a>
<tr>
<th>Value:
<td class="prod">auto <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-4/#comb-one" id="ref-for-comb-one④">|</a> block <span>|</span> swap <span>|</span> fallback <span>|</span> optional
<tr>
<th>Initial:
<td>auto
</table>
<div class="issue" id="issue-eb532bca">
<a class="self-link" href="#issue-eb532bca"></a> These names aren’t great.
It would probably be better to use "intent" names
that immediately capture the intended usage of each.
Some suggestions:
<ul>
<li data-md>
<p>required / important / preferable / optional</p>
</ul>
</div>
<h2 class="heading settled" data-level="5" id="acks"><span class="secno">5. </span><span class="content">Acknowledgements</span><a class="self-link" href="#acks"></a></h2>
<p>Special thanks to Ilya Grigorik and David Kuettel for their help in developing this specification.</p>
</main>
<h2 class="no-ref no-num heading settled" id="conformance"><span class="content"> Conformance</span><a class="self-link" href="#conformance"></a></h2>
<h3 class="heading settled" id="document-conventions"><span class="content"> Document conventions</span><a class="self-link" href="#document-conventions"></a></h3>
<p>Conformance requirements are expressed with a combination of
descriptive assertions and RFC 2119 terminology. The key words “MUST”,
“MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”,
“RECOMMENDED”, “MAY”, and “OPTIONAL” in the normative parts of this
document are to be interpreted as described in RFC 2119.
However, for readability, these words do not appear in all uppercase
letters in this specification. </p>
<p>All of the text of this specification is normative except sections
explicitly marked as non-normative, examples, and notes. <a data-link-type="biblio" href="#biblio-rfc2119">[RFC2119]</a> </p>
<p>Examples in this specification are introduced with the words “for example”
or are set apart from the normative text with <code>class="example"</code>,
like this: </p>
<div class="example" id="example-ae2b6bc0">
<a class="self-link" href="#example-ae2b6bc0"></a>
<p>This is an example of an informative example. </p>
</div>
<p>Informative notes begin with the word “Note” and are set apart from the
normative text with <code>class="note"</code>, like this: </p>
<p class="note" role="note">Note, this is an informative note. </p>
<p>Advisements are normative sections styled to evoke special attention and are
set apart from other normative text with <code><strong class="advisement"></code>, like
this: <strong class="advisement"> UAs MUST provide an accessible alternative. </strong> </p>
<h3 class="heading settled" id="conform-classes"><span class="content"> Conformance classes</span><a class="self-link" href="#conform-classes"></a></h3>
<p>Conformance to this specification
is defined for three conformance classes: </p>
<dl>
<dt>style sheet
<dd>A <a href="http://www.w3.org/TR/CSS2/conform.html#style-sheet">CSS
style sheet</a>.
<dt>renderer
<dd>A <a href="http://www.w3.org/TR/CSS2/conform.html#user-agent">UA</a> that interprets the semantics of a style sheet and renders
documents that use them.
<dt>authoring tool
<dd>A <a href="http://www.w3.org/TR/CSS2/conform.html#user-agent">UA</a> that writes a style sheet.
</dl>
<p>A style sheet is conformant to this specification
if all of its statements that use syntax defined in this module are valid
according to the generic CSS grammar and the individual grammars of each
feature defined in this module. </p>
<p>A renderer is conformant to this specification
if, in addition to interpreting the style sheet as defined by the
appropriate specifications, it supports all the features defined
by this specification by parsing them correctly
and rendering the document accordingly. However, the inability of a
UA to correctly render a document due to limitations of the device
does not make the UA non-conformant. (For example, a UA is not
required to render color on a monochrome monitor.) </p>
<p>An authoring tool is conformant to this specification
if it writes style sheets that are syntactically correct according to the
generic CSS grammar and the individual grammars of each feature in
this module, and meet all other conformance requirements of style sheets
as described in this module. </p>
<h3 class="heading settled" id="conform-responsible"><span class="content"> Requirements for Responsible Implementation of CSS</span><a class="self-link" href="#conform-responsible"></a></h3>
<p>The following sections define several conformance requirements
for implementing CSS responsibly,
in a way that promotes interoperability in the present and future. </p>
<h4 class="heading settled" id="conform-partial"><span class="content"> Partial Implementations</span><a class="self-link" href="#conform-partial"></a></h4>
<p>So that authors can exploit the forward-compatible parsing rules to assign fallback values, <strong>CSS renderers <em>must</em> treat as invalid
(and <a href="http://www.w3.org/TR/CSS2/conform.html#ignore">ignore as appropriate</a>)
any at-rules, properties, property values, keywords, and other syntactic constructs
for which they have no usable level of support</strong>.
In particular, user agents <em>must not</em> selectively ignore
unsupported property values and honor supported values in a single multi-value property declaration:
if any value is considered invalid (as unsupported values must be),
CSS requires that the entire declaration be ignored. </p>
<h4 class="heading settled" id="conform-future-proofing"><span class="content"> Implementations of Unstable and Proprietary Features</span><a class="self-link" href="#conform-future-proofing"></a></h4>
<p>To avoid clashes with future stable CSS features,
the CSSWG recommends <a href="http://www.w3.org/TR/CSS/#future-proofing">following best practices</a> for the implementation of <a href="http://www.w3.org/TR/CSS/#unstable">unstable</a> features and <a href="http://www.w3.org/TR/CSS/#proprietary-extension">proprietary extensions</a> to CSS. </p>
<h4 class="heading settled" id="conform-testing"><span class="content"> Implementations of CR-level Features</span><a class="self-link" href="#conform-testing"></a></h4>
<p>Once a specification reaches the Candidate Recommendation stage,
implementers should release an <a data-link-type="dfn" href="http://www.w3.org/TR/CSS/#vendor-prefix">unprefixed</a> implementation
of any CR-level feature they can demonstrate
to be correctly implemented according to spec,
and should avoid exposing a prefixed variant of that feature. </p>
<p>To establish and maintain the interoperability of CSS across
implementations, the CSS Working Group requests that non-experimental
CSS renderers submit an implementation report (and, if necessary, the
testcases used for that implementation report) to the W3C before
releasing an unprefixed implementation of any CSS features. Testcases
submitted to W3C are subject to review and correction by the CSS
Working Group. </p>
<p>
Further information on submitting testcases and implementation reports
can be found from on the CSS Working Group’s website at <a href="http://www.w3.org/Style/CSS/Test/">http://www.w3.org/Style/CSS/Test/</a>.
Questions should be directed to the <a href="http://lists.w3.org/Archives/Public/public-css-testsuite">public-css-testsuite@w3.org</a> mailing list.
<script src="https://www.w3.org/scripts/TR/2016/fixup.js"></script>
</p>
<h2 class="no-num no-ref heading settled" id="index"><span class="content">Index</span><a class="self-link" href="#index"></a></h2>
<h3 class="no-num no-ref heading settled" id="index-defined-here"><span class="content">Terms defined by this specification</span><a class="self-link" href="#index-defined-here"></a></h3>
<ul class="index">
<li><a href="#valdef-font-face-font-display-auto">auto</a><span>, in §3</span>
<li><a href="#valdef-font-face-font-display-block">block</a><span>, in §3</span>
<li><a href="#font-block-period">block period</a><span>, in §2</span>
<li><a href="#font-failure-period">failure period</a><span>, in §2</span>
<li><a href="#valdef-font-face-font-display-fallback">fallback</a><span>, in §3</span>
<li><a href="#font-block-period">font block period</a><span>, in §2</span>
<li>
font-display
<ul>
<li><a href="#descdef-font-face-font-display">descriptor for @font-face</a><span>, in §3</span>
<li><a href="#descdef-font-feature-values-font-display">descriptor for @font-feature-values</a><span>, in §4</span>
</ul>
<li><a href="#font-download-timer">font download timer</a><span>, in §2</span>
<li><a href="#font-failure-period">font failure period</a><span>, in §2</span>
<li><a href="#font-swap-period">font swap period</a><span>, in §2</span>
<li><a href="#valdef-font-face-font-display-optional">optional</a><span>, in §3</span>
<li><a href="#render-with-a-fallback-font-face">render with a fallback font face</a><span>, in §2</span>
<li><a href="#render-with-an-invisible-fallback-font-face">render with an invisible fallback font face</a><span>, in §2</span>
<li><a href="#valdef-font-face-font-display-swap">swap</a><span>, in §3</span>
<li><a href="#font-swap-period">swap period</a><span>, in §2</span>
<li><a href="#font-download-timer">timer</a><span>, in §2</span>
</ul>
<aside class="dfn-panel" data-for="term-for-propdef-font-family">
<a href="https://drafts.csswg.org/css-fonts-3/#propdef-font-family">https://drafts.csswg.org/css-fonts-3/#propdef-font-family</a><b>Referenced in:</b>
<ul>
<li><a href="#ref-for-propdef-font-family">2. The Font Display Timeline</a>
</ul>
</aside>
<aside class="dfn-panel" data-for="term-for-at-font-face-rule">
<a href="https://drafts.csswg.org/css-fonts-4/#at-font-face-rule">https://drafts.csswg.org/css-fonts-4/#at-font-face-rule</a><b>Referenced in:</b>
<ul>
<li><a href="#ref-for-at-font-face-rule①">1. Introduction</a>
<li><a href="#ref-for-at-font-face-rule②">3. Controlling Font Display Per Font-Face: the font-display descriptor</a> <a href="#ref-for-at-font-face-rule③">(2)</a>
</ul>
</aside>
<aside class="dfn-panel" data-for="term-for-comb-one">
<a href="https://drafts.csswg.org/css-values-4/#comb-one">https://drafts.csswg.org/css-values-4/#comb-one</a><b>Referenced in:</b>
<ul>
<li><a href="#ref-for-comb-one">3. Controlling Font Display Per Font-Face: the font-display descriptor</a> <a href="#ref-for-comb-one①">(2)</a> <a href="#ref-for-comb-one②">(3)</a> <a href="#ref-for-comb-one③">(4)</a>
<li><a href="#ref-for-comb-one④">4. Controlling Font Display Per Font-Family via @font-feature-values</a> <a href="#ref-for-comb-one⑤">(2)</a> <a href="#ref-for-comb-one⑥">(3)</a> <a href="#ref-for-comb-one⑦">(4)</a>
</ul>
</aside>
<h3 class="no-num no-ref heading settled" id="index-defined-elsewhere"><span class="content">Terms defined by reference</span><a class="self-link" href="#index-defined-elsewhere"></a></h3>
<ul class="index">
<li>
<a data-link-type="biblio">[css-fonts-3]</a> defines the following terms:
<ul>
<li><span class="dfn-paneled" id="term-for-propdef-font-family" style="color:initial">font-family</span>
</ul>
<li>
<a data-link-type="biblio">[css-fonts-4]</a> defines the following terms:
<ul>
<li><span class="dfn-paneled" id="term-for-at-font-face-rule" style="color:initial">@font-face</span>
</ul>
<li>
<a data-link-type="biblio">[css-values-4]</a> defines the following terms:
<ul>
<li><span class="dfn-paneled" id="term-for-comb-one" style="color:initial">|</span>
</ul>
</ul>
<h2 class="no-num no-ref heading settled" id="references"><span class="content">References</span><a class="self-link" href="#references"></a></h2>
<h3 class="no-num no-ref heading settled" id="normative"><span class="content">Normative References</span><a class="self-link" href="#normative"></a></h3>
<dl>
<dt id="biblio-css-fonts-3">[CSS-FONTS-3]
<dd>John Daggett; Myles Maxfield; Chris Lilley. <a href="https://www.w3.org/TR/css-fonts-3/">CSS Fonts Module Level 3</a>. 14 August 2018. PR. URL: <a href="https://www.w3.org/TR/css-fonts-3/">https://www.w3.org/TR/css-fonts-3/</a>
<dt id="biblio-css-fonts-4">[CSS-FONTS-4]
<dd>John Daggett; Myles Maxfield. <a href="https://www.w3.org/TR/css-fonts-4/">CSS Fonts Module Level 4</a>. 10 April 2018. WD. URL: <a href="https://www.w3.org/TR/css-fonts-4/">https://www.w3.org/TR/css-fonts-4/</a>
<dt id="biblio-css-values-4">[CSS-VALUES-4]
<dd>Tab Atkins Jr.; Elika Etemad. <a href="https://www.w3.org/TR/css-values-4/">CSS Values and Units Module Level 4</a>. 14 August 2018. WD. URL: <a href="https://www.w3.org/TR/css-values-4/">https://www.w3.org/TR/css-values-4/</a>
<dt id="biblio-rfc2119">[RFC2119]
<dd>S. Bradner. <a href="https://tools.ietf.org/html/rfc2119">Key words for use in RFCs to Indicate Requirement Levels</a>. March 1997. Best Current Practice. URL: <a href="https://tools.ietf.org/html/rfc2119">https://tools.ietf.org/html/rfc2119</a>
</dl>
<h3 class="no-num no-ref heading settled" id="informative"><span class="content">Informative References</span><a class="self-link" href="#informative"></a></h3>
<dl>
<dt id="biblio-css-font-loading-3">[CSS-FONT-LOADING-3]
<dd>Tab Atkins Jr.. <a href="https://www.w3.org/TR/css-font-loading-3/">CSS Font Loading Module Level 3</a>. 22 May 2014. WD. URL: <a href="https://www.w3.org/TR/css-font-loading-3/">https://www.w3.org/TR/css-font-loading-3/</a>
</dl>
<h2 class="no-num no-ref heading settled" id="property-index"><span class="content">Property Index</span><a class="self-link" href="#property-index"></a></h2>
<p>No properties defined.</p>
<h3 class="no-num no-ref heading settled" id="font-face-descriptor-table"><span class="content"><a class="css" data-link-type="at-rule" href="https://drafts.csswg.org/css-fonts-4/#at-font-face-rule" id="ref-for-at-font-face-rule④">@font-face</a> Descriptors</span><a class="self-link" href="#font-face-descriptor-table"></a></h3>
<div class="big-element-wrapper">
<table class="index">
<thead>
<tr>
<th scope="col">Name
<th scope="col">Value
<th scope="col">Initial
<tbody>
<tr>
<th scope="row"><a class="css" data-link-type="descriptor" href="#descdef-font-face-font-display" id="ref-for-descdef-font-face-font-display②">font-display</a>
<td>auto | block | swap | fallback | optional
<td>auto
</table>
</div>
<h3 class="no-num no-ref heading settled" id="font-feature-values-descriptor-table"><span class="content"><a class="css" data-link-type="at-rule">@font-feature-values</a> Descriptors</span><a class="self-link" href="#font-feature-values-descriptor-table"></a></h3>
<div class="big-element-wrapper">
<table class="index">
<thead>
<tr>
<th scope="col">Name
<th scope="col">Value
<th scope="col">Initial
<tbody>
<tr>
<th scope="row"><a class="css" data-link-type="descriptor" href="#descdef-font-face-font-display" id="ref-for-descdef-font-face-font-display③">font-display</a>
<td>auto | block | swap | fallback | optional
<td>auto
</table>
</div>
<h2 class="no-num no-ref heading settled" id="issues-index"><span class="content">Issues Index</span><a class="self-link" href="#issues-index"></a></h2>
<div style="counter-reset:issue">
<div class="issue"> <a class="css" data-link-type="maybe" href="#valdef-font-face-font-display-fallback">fallback</a> and <a class="css" data-link-type="maybe" href="#valdef-font-face-font-display-optional">optional</a> can result in some faces in a family being used
while others are required to fallback,
giving a "ransom note" look.
Perhaps require that all fonts in a family have the same behavior (all swapped in, or all fallback)?
See also the @font-feature-values for controlling the behavior on a font family basis.<a href="#issue-160eca9c"> ↵ </a></div>
<div class="issue">
These names aren’t great.
It would probably be better to use "intent" names
that immediately capture the intended usage of each.
Some suggestions:
<ul>
<li data-md>
<p>required / important / preferable / optional</p>
</ul>
<a href="#issue-eb532bca"> ↵ </a>
</div>
</div>
<aside class="dfn-panel" data-for="font-block-period">
<b><a href="#font-block-period">#font-block-period</a></b><b>Referenced in:</b>
<ul>
<li><a href="#ref-for-font-block-period">2. The Font Display Timeline</a> <a href="#ref-for-font-block-period①">(2)</a> <a href="#ref-for-font-block-period②">(3)</a>
<li><a href="#ref-for-font-block-period③">3. Controlling Font Display Per Font-Face: the font-display descriptor</a> <a href="#ref-for-font-block-period④">(2)</a> <a href="#ref-for-font-block-period⑤">(3)</a> <a href="#ref-for-font-block-period⑥">(4)</a> <a href="#ref-for-font-block-period⑦">(5)</a>
</ul>
</aside>
<aside class="dfn-panel" data-for="font-swap-period">
<b><a href="#font-swap-period">#font-swap-period</a></b><b>Referenced in:</b>
<ul>
<li><a href="#ref-for-font-swap-period">2. The Font Display Timeline</a> <a href="#ref-for-font-swap-period①">(2)</a> <a href="#ref-for-font-swap-period②">(3)</a>
<li><a href="#ref-for-font-swap-period③">3. Controlling Font Display Per Font-Face: the font-display descriptor</a> <a href="#ref-for-font-swap-period④">(2)</a> <a href="#ref-for-font-swap-period⑤">(3)</a> <a href="#ref-for-font-swap-period⑥">(4)</a>
</ul>
</aside>
<aside class="dfn-panel" data-for="font-failure-period">
<b><a href="#font-failure-period">#font-failure-period</a></b><b>Referenced in:</b>
<ul>
<li><a href="#ref-for-font-failure-period">2. The Font Display Timeline</a>
</ul>
</aside>
<aside class="dfn-panel" data-for="render-with-a-fallback-font-face">
<b><a href="#render-with-a-fallback-font-face">#render-with-a-fallback-font-face</a></b><b>Referenced in:</b>
<ul>
<li><a href="#ref-for-render-with-a-fallback-font-face">2. The Font Display Timeline</a> <a href="#ref-for-render-with-a-fallback-font-face①">(2)</a>
</ul>
</aside>
<aside class="dfn-panel" data-for="render-with-an-invisible-fallback-font-face">
<b><a href="#render-with-an-invisible-fallback-font-face">#render-with-an-invisible-fallback-font-face</a></b><b>Referenced in:</b>
<ul>
<li><a href="#ref-for-render-with-an-invisible-fallback-font-face">2. The Font Display Timeline</a>
</ul>
</aside>
<aside class="dfn-panel" data-for="descdef-font-face-font-display">
<b><a href="#descdef-font-face-font-display">#descdef-font-face-font-display</a></b><b>Referenced in:</b>
<ul>
<li><a href="#ref-for-descdef-font-face-font-display">3. Controlling Font Display Per Font-Face: the font-display descriptor</a> <a href="#ref-for-descdef-font-face-font-display①">(2)</a>
</ul>
</aside>
<aside class="dfn-panel" data-for="valdef-font-face-font-display-fallback">
<b><a href="#valdef-font-face-font-display-fallback">#valdef-font-face-font-display-fallback</a></b><b>Referenced in:</b>
<ul>
<li><a href="#ref-for-valdef-font-face-font-display-fallback">2. The Font Display Timeline</a>
</ul>
</aside>
<aside class="dfn-panel" data-for="valdef-font-face-font-display-optional">
<b><a href="#valdef-font-face-font-display-optional">#valdef-font-face-font-display-optional</a></b><b>Referenced in:</b>
<ul>
<li><a href="#ref-for-valdef-font-face-font-display-optional">2. The Font Display Timeline</a>
<li><a href="#ref-for-valdef-font-face-font-display-optional①">3. Controlling Font Display Per Font-Face: the font-display descriptor</a> <a href="#ref-for-valdef-font-face-font-display-optional②">(2)</a>
</ul>
</aside>
<aside class="dfn-panel" data-for="descdef-font-feature-values-font-display">
<b><a href="#descdef-font-feature-values-font-display">#descdef-font-feature-values-font-display</a></b><b>Referenced in:</b>
<ul>
<li><a href="#ref-for-descdef-font-feature-values-font-display">4. Controlling Font Display Per Font-Family via @font-feature-values</a>
</ul>
</aside>
<script>/* script-dfn-panel */
document.body.addEventListener("click", function(e) {
var queryAll = function(sel) { return [].slice.call(document.querySelectorAll(sel)); }
// Find the dfn element or panel, if any, that was clicked on.
var el = e.target;
var target;
var hitALink = false;
while(el.parentElement) {
if(el.tagName == "A") {
// Clicking on a link in a <dfn> shouldn't summon the panel
hitALink = true;
}
if(el.classList.contains("dfn-paneled")) {
target = "dfn";
break;
}
if(el.classList.contains("dfn-panel")) {
target = "dfn-panel";
break;
}
el = el.parentElement;
}
if(target != "dfn-panel") {
// Turn off any currently "on" or "activated" panels.
queryAll(".dfn-panel.on, .dfn-panel.activated").forEach(function(el){
el.classList.remove("on");
el.classList.remove("activated");
});
}
if(target == "dfn" && !hitALink) {
// open the panel
var dfnPanel = document.querySelector(".dfn-panel[data-for='" + el.id + "']");
if(dfnPanel) {
dfnPanel.classList.add("on");
var rect = el.getBoundingClientRect();
dfnPanel.style.left = window.scrollX + rect.right + 5 + "px";
dfnPanel.style.top = window.scrollY + rect.top + "px";
var panelRect = dfnPanel.getBoundingClientRect();
var panelWidth = panelRect.right - panelRect.left;
if(panelRect.right > document.body.scrollWidth && (rect.left - (panelWidth + 5)) > 0) {
// Reposition, because the panel is overflowing
dfnPanel.style.left = window.scrollX + rect.left - (panelWidth + 5) + "px";
}
} else {
console.log("Couldn't find .dfn-panel[data-for='" + el.id + "']");
}
} else if(target == "dfn-panel") {
// Switch it to "activated" state, which pins it.
el.classList.add("activated");
el.style.left = null;
el.style.top = null;
}
});
</script>