Skip to content

Commit 20a9e92

Browse files
committed
[css-fonts-5] add incremental example, see #6063
1 parent c012f50 commit 20a9e92

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

css-fonts-5/Overview.bs

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ spec:css-fonts-4; type:descriptor; text:font-language-override
2929
spec:css-fonts-4; type:property; text:font-family
3030
spec:css-fonts-4; type:property; text:font-style
3131
spec:css-fonts-4; type:property; text:font-weight
32+
spec:css-fonts-4; type:descriptor; text:src
3233
</pre>
3334

3435

@@ -345,6 +346,71 @@ The <dfn id="at-font-face-rule">''@font-face''</dfn> rule</h3>
345346
Multiple fonts can be used within an individual element
346347
e.g. for characters not supported by the [=first available font=].
347348

349+
<h3 id="src-desc">Font reference: the 'src' descriptor</h3>
350+
351+
<h4 id="font-face-src-parsing">Parsing the 'src!!descriptor' descriptor</h4>
352+
353+
Note: this level adds the incremental font technology.
354+
355+
356+
The 'src!!descriptor' descriptor value must be parsed
357+
according to section [[css-syntax#parse-comma-separated-list-of-component-values]].
358+
Then each component value is parsed according to this grammar:
359+
360+
361+
<pre><<url>> [ format(<<font-format>> [supports <<font-technology>>#]?)]? | local(<<font-face-name>>)</pre>
362+
363+
<pre class="prod"><dfn id="font-format-values">&lt;font-format&gt;</dfn>
364+
= [<<string>> | woff | truetype | opentype
365+
| woff2 | embedded-opentype | collection | svg]</pre>
366+
367+
<pre class="prod"><dfn id="font-technology-values">&lt;font-technology&gt;</dfn>
368+
= [features(<<font-feature-technology>>) | variations
369+
| color(<<color-font-technology>>) | palettes
370+
| incremental ]</pre>
371+
372+
<pre class="prod"><dfn id="font-feature-technology-values">&lt;font-feature-technology&gt;</dfn>
373+
= [opentype | aat | graphite]</pre>
374+
375+
<pre class="prod"><dfn id="color-font-technology-values">&lt;color-font-technology&gt;</dfn>
376+
= [COLRv0 | COLRv1 | SVG | sbix | CBDT ]</pre>
377+
378+
If a component value is parsed correctly
379+
and is of a format and font technology that the UA supports,
380+
add it to the list of supported sources.
381+
If parsing a component value results in a parsing error
382+
or its format or technology are unsupported,
383+
do not add it to the list of supported sources.
384+
385+
If there are no supported entries at the end of this process,
386+
the value for the 'src!!descriptor' descriptor is a parse error.
387+
388+
These parsing rules allow for graceful fallback of fonts
389+
for user agents which don't support a particular font technology.
390+
391+
<div class="example" id="ex-incremental">
392+
For example,
393+
when incremental transfer is not supported,
394+
a woff2 compressed version of the font
395+
is supplied,
396+
for optimal performance.
397+
Then,
398+
for incremental transfer using the
399+
<a href="https://www.w3.org/TR/2020/NOTE-PFE-evaluation-20201015/#range-request">range-request method</a>,
400+
the raw uncompressed OpenType font is provided
401+
so that the client
402+
can perform byte range requests.
403+
404+
<pre>
405+
@font-face {
406+
font-family: "MyIncrementallyLoadedWebFont";
407+
src: url("FallbackURLForBrowsersWhichDontSupportIncrementalLoading.woff2") format("woff2");
408+
src: url("MyIncrementallyLoadedWebFont.otf") format(opentype supports incremental);
409+
}
410+
</pre>
411+
</div>
412+
413+
348414
<h3 id="font-size-desc">
349415
Font property descriptors: the 'font-size!!descriptor'
350416
</h3>

0 commit comments

Comments
 (0)