Skip to content

Commit fcff4d3

Browse files
committed
[css-fonts-4] Clean up some of src descriptor
1 parent 838b144 commit fcff4d3

File tree

1 file changed

+150
-118
lines changed

1 file changed

+150
-118
lines changed

css-fonts-4/Overview.bs

Lines changed: 150 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -1600,133 +1600,165 @@ The <dfn id="at-font-face-rule">''@font-face''</dfn> rule</h3>
16001600

16011601
<h3 id="font-family-desc">Font family: the '@font-face/font-family' descriptor</h3>
16021602

1603-
<pre class='descdef'>
1604-
Name: font-family
1605-
Value: <<family-name>>
1606-
For: @font-face
1607-
Initial: N/A
1608-
</pre>
1603+
<pre class='descdef'>
1604+
Name: font-family
1605+
Value: <<family-name>>
1606+
For: @font-face
1607+
Initial: N/A
1608+
</pre>
16091609

1610-
This descriptor defines the font family name that will be used in
1611-
all CSS font family name matching. It is required for the ''@font-face''
1612-
rule to be valid. It overrides the font family names contained in the
1613-
underlying font data. If the font family name is the same as a font
1614-
family available in a given user's environment, it effectively hides
1615-
the underlying font for documents that use the stylesheet. This
1616-
permits a web author to freely choose font-family names without
1617-
worrying about conflicts with font family names present in a given
1618-
user's environment. Likewise, platform substitutions for a given font
1619-
family name must not be used.
1610+
This descriptor defines the font family name
1611+
that will be used in all CSS font family name matching.
1612+
It is required for the ''@font-face'' rule to be valid.
1613+
It overrides the font family names
1614+
contained in the underlying font data.
1615+
If the font family name is the same
1616+
as a font family available in a given user's environment,
1617+
it effectively hides the underlying font
1618+
for documents that use the stylesheet.
1619+
This permits a web author to freely choose font-family names
1620+
without worrying about conflicts with font family names
1621+
present in a given user's environment.
1622+
Likewise, platform substitutions
1623+
for a given font family name
1624+
must not be used.
16201625

16211626
<h3 id="src-desc">Font reference: the 'src' descriptor</h3>
16221627

1623-
<pre class='descdef'>
1624-
Name: src
1625-
Value: [ <<url>> [ format( <<string>> # )]? | local(<<font-face-name>>) ] #
1626-
For: @font-face
1627-
Initial: N/A
1628-
</pre>
1628+
<pre class='descdef'>
1629+
Name: src
1630+
Value: [ <<url>> [ format( <<string>> # )]? | local(<<font-face-name>>) ] #
1631+
For: @font-face
1632+
Initial: N/A
1633+
</pre>
16291634

1630-
This descriptor specifies the resource containing font data. It is
1631-
required for the ''@font-face'' rule to be valid. Its value
1632-
is a prioritized, comma-separated list of external references or
1633-
locally-installed font face names. When a font is needed the user
1634-
agent iterates over the set of references listed, using the first one
1635-
it can successfully activate. Activation of a font involves downloading
1636-
the file or reading it from disk, parsing it, and perhaps additional user-agent-dependent steps.
1637-
Fonts containing invalid data or local
1638-
font faces that are not found are ignored and the user agent loads the
1639-
next font in the list.
1640-
1641-
As with other URLs in CSS, the URL can be relative, in which case it
1642-
is resolved relative to the location of the style sheet containing the
1643-
''@font-face'' rule. In
1644-
the case images/of SVG fonts, the URL points to an element within a document
1645-
images/containing SVG font definitions. If the element reference is omitted,
1646-
a reference to the first defined font is implied. Similarly, font
1647-
container formats that can contain more than one font must load one
1648-
and only one of the fonts for a given ''@font-face'' rule. Fragment
1649-
identifiers are used to indicate which font to load; these use the PostScript
1650-
name of the font as defined in [[!RFC8081]].
1651-
Conformant user agents must skip downloading a font resource if the fragment
1652-
identifier is unknown or unsupported. For example, older user agents which
1653-
do not support OpenType collections will skip to the next url in the list. </p>
1635+
This descriptor specifies the resource containing font data.
1636+
It is required for the ''@font-face'' rule to be valid.
1637+
Its value is
1638+
a prioritized,
1639+
comma-separated list
1640+
of external references
1641+
or locally-installed font face names.
1642+
When a font is needed
1643+
the user agent iterates over the set of references listed,
1644+
using the first one it can successfully activate.
1645+
Activation of a font involves downloading the file
1646+
or reading it from disk,
1647+
parsing it,
1648+
and perhaps additional user-agent-dependent steps.
1649+
Fonts containing invalid data
1650+
or local font faces
1651+
that are not found
1652+
are ignored
1653+
and the user agent loads the next font in the list.
1654+
1655+
As with other URLs in CSS,
1656+
the URL can be relative,
1657+
in which case
1658+
it is resolved relative to the location of the style sheet
1659+
containing the ''@font-face'' rule.
1660+
In the case of SVG fonts,
1661+
the URL points to an element within a document
1662+
containing SVG font definitions.
1663+
If the element reference is omitted,
1664+
a reference to the first defined font is implied.
1665+
Similarly, font container formats
1666+
that can contain more than one font
1667+
must load one and only one of the fonts
1668+
for a given ''@font-face'' rule.
1669+
Fragment identifiers are used to indicate which font to load;
1670+
these use the PostScript name of the font
1671+
as defined in [[!RFC8081]].
1672+
Conformant user agents
1673+
must skip downloading a font resource
1674+
if the fragment identifier is unknown
1675+
or unsupported.
1676+
For example, older user agents
1677+
which do not support OpenType collections
1678+
will skip to the next url in the list. </p>
16541679

1655-
<pre>
1656-
src: url(fonts/simple.woff); /* load simple.woff relative to stylesheet location */
1657-
src: url(/fonts/simple.woff); /* load simple.woff from absolute location */
1658-
src: url(fonts/coll.otc#foo); /* load font foo from collection coll.otc
1659-
src: url(fonts/coll.woff2#foo); /* load font foo from woff2 collection coll.woff2
1660-
src: url(fonts.svg#simple); /* load SVG font with id 'simple' */
1661-
</pre>
1680+
<pre>
1681+
src: url(fonts/simple.woff); /* load simple.woff relative to stylesheet location */
1682+
src: url(/fonts/simple.woff); /* load simple.woff from absolute location */
1683+
src: url(fonts/coll.otc#foo); /* load font foo from collection coll.otc
1684+
src: url(fonts/coll.woff2#foo); /* load font foo from woff2 collection coll.woff2
1685+
src: url(fonts.svg#simple); /* load SVG font with id 'simple' */
1686+
</pre>
16621687

1663-
External references consist of a URL, followed by an optional hint
1664-
describing the format of the font resource referenced by that URL. The
1665-
format hint contains a comma-separated list of format strings that
1666-
denote well-known font formats. Conformant user agents must skip
1667-
downloading a font resource if the format hints indicate only
1668-
unsupported or unknown font formats. If no format hints are supplied,
1669-
the user agent should download the font resource.
1688+
External references consist of a URL,
1689+
followed by an optional hint
1690+
describing the format of the font resource referenced by that URL.
1691+
The format hint contains a comma-separated list of format strings
1692+
that denote well-known font formats.
1693+
Conformant user agents
1694+
must skip downloading a font resource
1695+
if the format hints indicate only unsupported or unknown font formats.
1696+
If no format hints are supplied,
1697+
the user agent should download the font resource.
16701698

1671-
<pre>
1672-
/* load WOFF font if possible, otherwise use OpenType font */
1673-
@font-face {
1674-
font-family: bodytext;
1675-
src: url(ideal-sans-serif.woff) format("woff"),
1676-
url(basic-sans-serif.ttf) format("opentype");
1677-
}
1678-
</pre>
1699+
<pre>
1700+
/* load WOFF font if possible, otherwise use OpenType font */
1701+
@font-face {
1702+
font-family: bodytext;
1703+
src: url(ideal-sans-serif.woff) format("woff"),
1704+
url(basic-sans-serif.ttf) format("opentype");
1705+
}
1706+
</pre>
1707+
1708+
Format strings defined by this specification:
16791709

1680-
Format strings defined by this specification:
1681-
1682-
<table class="data" id="fontformats">
1683-
<thead>
1684-
<tr>
1685-
<th>String
1686-
<th>Font Format
1687-
<th>Common extensions
1688-
<tbody>
1689-
<tr>
1690-
<th>"woff"
1691-
<td><a href="https://www.w3.org/TR/WOFF/">WOFF (Web Open Font Format)</a>
1692-
<td>.woff
1693-
<tr>
1694-
<th>"truetype"
1695-
<td><a href="https://www.microsoft.com/typography/otspec/default.htm">TrueType</a>
1696-
<td>.ttf
1697-
<tr>
1698-
<th>"opentype"
1699-
<td><a href="https://www.microsoft.com/typography/otspec/default.htm">OpenType</a>
1700-
<td>.ttf, .otf
1701-
<tr>
1702-
<th>"woff2"
1703-
<td><a href="https://www.w3.org/TR/WOFF2/">WOFF File Format 2.0 (Web Open Font Format)</a>
1704-
<td>.woff2
1705-
<tr>
1706-
<th>"embedded-opentype"
1707-
<td><a href="https://www.w3.org/Submission/2008/SUBM-EOT-20080305/">Embedded OpenType</a>
1708-
<td>.eot
1709-
<tr>
1710-
<th>"svg"
1711-
<td><a href="https://www.w3.org/TR/SVG11/fonts.html">SVG Font</a>
1712-
<td>.svg, .svgz
1713-
<tr>
1714-
<th>"woff-variations"
1715-
<td><a href="https://www.w3.org/TR/WOFF/">WOFF (Web Open Font Format) with associated variations support</a>
1716-
<td>.woff
1717-
<tr>
1718-
<th>"truetype-variations"
1719-
<td><a href="https://www.microsoft.com/typography/otspec/default.htm">TrueType with associated variations support</a>
1720-
<td>.ttf
1721-
<tr>
1722-
<th>"opentype-variations"
1723-
<td><a href="https://www.microsoft.com/typography/otspec/default.htm">OpenType with associated variations support</a>
1724-
<td>.ttf, .otf
1725-
<tr>
1726-
<th>"woff2-variations"
1727-
<td><a href="https://www.w3.org/TR/WOFF2/">WOFF File Format 2.0 (Web Open Font Format) with associated variations support</a>
1728-
<td>.woff2
1729-
</table>
1710+
<table class="data" id="fontformats">
1711+
<thead>
1712+
<tr>
1713+
<th>String
1714+
<th>Font Format
1715+
<th>Common extensions
1716+
<tbody>
1717+
<tr>
1718+
<th>"woff"
1719+
<td><a href="https://www.w3.org/TR/WOFF/">WOFF (Web Open Font Format)</a>
1720+
<td>.woff
1721+
<tr>
1722+
<th>"truetype"
1723+
<td><a href="https://www.microsoft.com/typography/otspec/default.htm">TrueType</a>
1724+
<td>.ttf
1725+
<tr>
1726+
<th>"opentype"
1727+
<td><a href="https://www.microsoft.com/typography/otspec/default.htm">OpenType</a>
1728+
<td>.ttf, .otf
1729+
<tr>
1730+
<th>"woff2"
1731+
<td><a href="https://www.w3.org/TR/WOFF2/">WOFF File Format 2.0 (Web Open Font Format)</a>
1732+
<td>.woff2
1733+
<tr>
1734+
<th>"embedded-opentype"
1735+
<td><a href="https://www.w3.org/Submission/2008/SUBM-EOT-20080305/">Embedded OpenType</a>
1736+
<td>.eot
1737+
<tr>
1738+
<th>"svg"
1739+
<td><a href="https://www.w3.org/TR/SVG11/fonts.html">SVG Font</a> (deprecated)
1740+
<td>.svg, .svgz
1741+
<tr>
1742+
<th>"woff-variations"
1743+
<td><a href="https://www.w3.org/TR/WOFF/">WOFF (Web Open Font Format)
1744+
with associated variations support</a>
1745+
<td>.woff
1746+
<tr>
1747+
<th>"truetype-variations"
1748+
<td><a href="https://www.microsoft.com/typography/otspec/default.htm">TrueType
1749+
with associated variations support</a>
1750+
<td>.ttf
1751+
<tr>
1752+
<th>"opentype-variations"
1753+
<td><a href="https://www.microsoft.com/typography/otspec/default.htm">OpenType
1754+
with associated variations support</a>
1755+
<td>.ttf, .otf
1756+
<tr>
1757+
<th>"woff2-variations"
1758+
<td><a href="https://www.w3.org/TR/WOFF2/">WOFF File Format 2.0 (Web Open Font Format)
1759+
with associated variations support</a>
1760+
<td>.woff2
1761+
</table>
17301762

17311763
Given the overlap in common usage between TrueType and OpenType, the
17321764
format hints "truetype" and "opentype" must be considered as synonymous;

0 commit comments

Comments
 (0)