Skip to content

Commit

Permalink
[css-fonts-4] Reference syntax spec for parsing comma separated descr…
Browse files Browse the repository at this point in the history
…iptor see #6340
  • Loading branch information
svgeesus committed Jun 9, 2021
1 parent 787534d commit 60dd3ff
Showing 1 changed file with 11 additions and 20 deletions.
31 changes: 11 additions & 20 deletions css-fonts-4/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1877,23 +1877,11 @@ The <dfn id="at-font-face-rule">''@font-face''</dfn> rule</h3>

<h4 id="font-face-src-parsing">Parsing the 'src!!descriptor' descriptor</h4>

The value of the 'src!!descriptor' descriptor is parsed piecewise.

First, opening and closing parentheses are matched.
If these parentheses cannot be matched,
the value is a parse error.
Matching the parentheses has the effect of
partitioning the value into multiple regions,
each of which is either
inside outermost parentheses
or outside outermost parentheses.
The 'src!!descriptor' descriptor value must be parsed
according to section [[css-syntax#parse-comma-separated-list-of-component-values]].
Then each component value is parsed according to this grammar:

Once the value is partitioned,
all the commas outside outermost parentheses
are located.
The value is then split at these comma locations.

Each item in the split value is then parsed against this grammar:

<pre><<url>> [ format(<<font-format>> [supports <<font-technology>>#]?)]? | local(<<font-face-name>>)</pre>

Expand All @@ -1903,12 +1891,15 @@ The <dfn id="at-font-face-rule">''@font-face''</dfn> rule</h3>

<pre class="prod"><dfn id="color-font-technology-values">&lt;color-font-technology&gt;</dfn> = [COLRv0 | COLRv1 | SVG | sbix | CBDT ]</pre>

If parsing a particular item in the split value results in a parse error,
that item is thrown out.

Issue: Define what "thrown out" means
If a component value is parsed correctly
and is of a format and font technology that the UA supports,
add it to the list of supported sources.
If parsing a component value results in a parsing error
or its format or technology are unsupported,
do not add it to the list of supported sources.

If no item in the split value survives, then the descriptor is a parse error.
If there are no supported entries at the end of this process,
the value for the 'src!!descriptor' descriptor is a parse error.

These parsing rules allow for graceful fallback of fonts
for user agents which don't support a particular font technology.
Expand Down

0 comments on commit 60dd3ff

Please sign in to comment.