@@ -1606,21 +1606,23 @@ The <dfn id="at-font-face-rule">''@font-face''</dfn> rule</h3>
16061606
16071607 <pre class='descdef'>
16081608 Name : src
1609- Value : [ <<url>> [ format( <<string>> # )]? | local(<<font-face-name>>) ] #
1609+ Value : see prose
16101610 For : @font-face
16111611 Initial : N/A
16121612 </pre>
16131613
16141614 This descriptor specifies the resource containing font data.
16151615 It is required for the ''@font-face'' rule to be valid.
16161616 Its value is
1617- a prioritized,
1617+ a prioritized,
16181618 comma-separated list
16191619 of external references
16201620 or locally-installed font face names.
16211621 When a font is needed
16221622 the user agent iterates over the set of references listed,
1623- using the first one it can successfully activate.
1623+ using the first one it can successfully parse and activate.
1624+ Parsing this descriptor is more complicated than parsing other descriptors;
1625+ see [[#font-face-src-parsing]] for the parsing rules.
16241626 Activation of a font involves downloading the file
16251627 or reading it from disk,
16261628 parsing it,
@@ -1631,6 +1633,46 @@ The <dfn id="at-font-face-rule">''@font-face''</dfn> rule</h3>
16311633 are ignored
16321634 and the user agent loads the next font in the list.
16331635
1636+ <h4 id="font-face-src-parsing">Parsing the 'src!!descriptor' descriptor</h4>
1637+
1638+ The value of the 'src!!descriptor' descriptor is parsed piecewise.
1639+
1640+ First, opening and closing parentheses are matched.
1641+ If these parentheses cannot be matched,
1642+ the value is a parse error.
1643+ Matching the parentheses has the effect of
1644+ partitioning the value into multiple regions,
1645+ each of which is either
1646+ inside outermost parentheses
1647+ or outside outermost parentheses.
1648+
1649+ Once the value is partitioned,
1650+ all the commas outside outermost parentheses
1651+ are located.
1652+ The value is then split at these comma locations.
1653+
1654+ Each item in the split value is then parsed against this grammar:
1655+
1656+ <pre> <<url>> [ format(<<font-format>> [supports <<font-technology>>#] ?)]? | local(<<font-face-name>> )</pre>
1657+
1658+ <pre class="prod"><dfn id="font-format-values"><font-format></dfn> = [<<string>> | woff | truetype | opentype | woff2 | embedded-opentype | svg]</pre>
1659+
1660+ <pre class="prod"><dfn id="font-technology-values"><font-technology></dfn> = [features | variations | color(<<color-font-technology>> ) | palettes]</pre>
1661+
1662+ <pre class="prod"><dfn id="color-font-technology-values"><color-font-technology></dfn> = [COLR | SVG | sbix]</pre>
1663+
1664+ If parsing a particular item in the split value results in a parse error,
1665+ that item is thrown out.
1666+
1667+ Issue: Define what "thrown out" means
1668+
1669+ If no item in the split value survives, then the descriptor is a parse error.
1670+
1671+ These parsing rules allow for graceful fallback of fonts
1672+ for user agents which don't support a particular font technology.
1673+
1674+ <h4 id="font-face-src-loading">Loading an individual item in the 'src!!descriptor' descriptor</h4>
1675+
16341676 As with other URLs in CSS,
16351677 the URL can be relative,
16361678 in which case
@@ -1664,27 +1706,33 @@ The <dfn id="at-font-face-rule">''@font-face''</dfn> rule</h3>
16641706 src: url(fonts.svg#simple); /* load SVG font with id 'simple' */
16651707 </pre>
16661708
1709+ <h4 id="font-face-src-formats">Selecting items in the 'src!!descriptor'</h4>
1710+
16671711 External references consist of a URL,
16681712 followed by an optional hint
16691713 describing the format of the font resource referenced by that URL.
1670- The format hint contains a comma-separated list of format strings
1671- that denote well-known font formats.
16721714 Conformant user agents
16731715 must skip downloading a font resource
1674- if the format hints indicate only unsupported or unknown font formats.
1675- If no format hints are supplied,
1716+ if the format hint indicates an unsupported or unknown font format,
1717+ or if any of the font technologies are unsupported by the user agent.
1718+ If no format hint is supplied,
16761719 the user agent should download the font resource.
16771720
1721+ <div class="example">
1722+ For example, the following shows how to load a WOFF font if possible, otherwise use an OpenType font
16781723 <pre>
1679- /* load WOFF font if possible, otherwise use OpenType font */
16801724 @font-face {
16811725 font-family: bodytext;
16821726 src: url(ideal-sans-serif.woff) format("woff"),
16831727 url(basic-sans-serif.ttf) format("opentype");
16841728 }
16851729 </pre>
1730+ </div>
16861731
1687- Format strings defined by this specification:
1732+ <h5 id="font-face-src-format-types">''@font-face'' format types</h5>
1733+
1734+ Format strings defined by this specification are as follows.
1735+ The <<font-format>> values are synonyms for the formats below.
16881736
16891737 <table class="data" id="fontformats">
16901738 <thead>
@@ -1717,26 +1765,6 @@ The <dfn id="at-font-face-rule">''@font-face''</dfn> rule</h3>
17171765 <th> "svg"
17181766 <td> <a href="https://www.w3.org/TR/SVG11/fonts.html">SVG Font</a> (deprecated)
17191767 <td> .svg, .svgz
1720- <tr>
1721- <th> "woff-variations"
1722- <td> <a href="https://www.w3.org/TR/WOFF/">WOFF (Web Open Font Format)
1723- with associated variations support</a>
1724- <td> .woff
1725- <tr>
1726- <th> "truetype-variations"
1727- <td> <a href="https://www.microsoft.com/typography/otspec/default.htm">TrueType
1728- with associated variations support</a>
1729- <td> .ttf
1730- <tr>
1731- <th> "opentype-variations"
1732- <td> <a href="https://www.microsoft.com/typography/otspec/default.htm">OpenType
1733- with associated variations support</a>
1734- <td> .ttf, .otf
1735- <tr>
1736- <th> "woff2-variations"
1737- <td> <a href="https://www.w3.org/TR/WOFF2/">WOFF File Format 2.0 (Web Open Font Format)
1738- with associated variations support</a>
1739- <td> .woff2
17401768 </table>
17411769
17421770 Given the overlap in common usage between TrueType and OpenType,
@@ -1747,23 +1775,50 @@ The <dfn id="at-font-face-rule">''@font-face''</dfn> rule</h3>
17471775 or that it contains OpenType layout information
17481776 (see <a href="#platform-props-to-css">Appendix A</a> for more background on this).
17491777
1750- A value of "woff-variations",
1751- "truetype-variations",
1752- "opentype-variations", or
1753- "woff2-variations"
1754- imply support of the "woff",
1755- "truetype",
1756- "opentype", or
1757- "woff2" formats respectively
1758- along with additional support
1759- for font variations.
1760- Web authors can specify this format
1761- to indicate that variation support is
1778+ <h5 id="font-face-src-requirement-types">''@font-face'' requirements</h5>
1779+
1780+ The 'features' requirement refers to support for font features,
1781+ commonly implemented in [[!OPENTYPE]] with the <code> GSUB</code> and the <code> GPOS</code> tables,
1782+ as well as in [[!AAT]] using the <code> morx</code> table.
1783+ The section on [[#font-rend-props]] describes properties that interact with these facilities.
1784+
1785+ The 'variations' requirement refers to the support of font variations,
1786+ commonly implemented in [[!OPENTYPE]] with the
1787+ <code> avar</code> , <code> cvar</code> , <code> fvar</code> , <code> gvar</code> , <code> HVAR</code> , <code> MVAR</code> , <code> STAT</code> , and <code> VVAR</code> tables,
1788+ as well as in [[!AAT]] using the <code> avar</code> , <code> cvar</code> , <code> fvar</code> , and <code> gvar</code> tables.
1789+ The section on [[#basic-font-props]] as well as the section on [[#font-variation-props]]
1790+ describe properties that interact with these facilities.
1791+
1792+ The 'color' requirement lists various types of color font file technologies.
1793+ Each of the arguments to the 'color' function represents a table
1794+ inside [[!OPENTYPE]] or [[!AAT]] fonts which must be supported
1795+ to satisfy this requirement.
1796+
1797+ The 'palettes' requirement refers to support for font palettes,
1798+ commonly implemented in the [[!OPENTYPE]] and [[!AAT]]
1799+ with the <code> CPAL</code> table.
1800+ The section on [[#color-font-support]] describes properties that interact with these facilities.
1801+
1802+ Web authors can specify the 'format' function
1803+ to indicate that support is
17621804 required for correct rendering of a font.
17631805 This mechanism can be used for gracefully falling back
17641806 to an ancillary font
17651807 when variation support is not present.
17661808
1809+ <div class="example">
1810+ This ''@font-face'' block shows how to use a color font if support is present on the user agent,
1811+ and falls back to a non-color-font if support is not present.
1812+ <pre>
1813+ @font-face {
1814+ font-family: "Trickster";
1815+ src: url("trickster-COLR.otf") format(opentype supports color(COLR)), url("trickster-outline.otf") format(opentype);
1816+ }
1817+ </pre>
1818+ </div>
1819+
1820+ <h5 id="local-font-fallback">Local font fallback</h5>
1821+
17671822 When authors would prefer to use
17681823 a locally available copy of a given font
17691824 and download it if it's not,
@@ -1840,20 +1895,22 @@ The <dfn id="at-font-face-rule">''@font-face''</dfn> rule</h3>
18401895 User agents that also match other full font names,
18411896 e.g. matching the Dutch name when the current system locale is set to Dutch,
18421897 are considered non-conformant.
1843- This is done
1844- not to prefer English
1898+
1899+ Note: This is done,
1900+ not to prefer English,
18451901 but to avoid matching inconsistencies
18461902 across font versions and OS localizations,
18471903 since font style names (e.g. "Bold")
18481904 are frequently localized into many languages
18491905 and the set of localizations available
18501906 varies widely across platform and font version.
1907+
18511908 User agents that match a concatenation of
18521909 family name (nameID = 1) with
18531910 style name (nameID = 2)
18541911 are considered non-conformant.
18551912
1856- This also allows for referencing faces
1913+ Note: This also allows for referencing faces
18571914 that belong to larger families
18581915 that cannot otherwise be referenced.
18591916
0 commit comments