Skip to content

Commit abfb767

Browse files
drottsvgeesus
authored andcommitted
[css-fonts] Update src: explainer to new syntax
1 parent 0da5a5a commit abfb767

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

css-fonts-4/src-explainer.md

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -257,9 +257,8 @@ See
257257

258258
## Examples
259259

260-
With the introduction of the `supports` part, the use cases 1 and 2 are then solved
261-
using [the current syntax](https://drafts.csswg.org/css-fonts-4/#src-desc)
262-
as follows:
260+
With the introduction of the `tech()` function part, the use cases 1 and 2 are then solved using [the current
261+
syntax](https://drafts.csswg.org/css-fonts-4/#src-desc) as follows:
263262

264263
### Use Case 1: Color Fonts
265264

@@ -268,9 +267,9 @@ as follows:
268267
/* 1. prefer COLRv1, then SVG-in-OpenType, then COLRv0 */
269268
@font-face {
270269
font-family: jewel;
271-
src: url(jewel-v1.woff2) format("woff2" supports COLRv1),
272-
url(jewel-svg.woff2) format("woff2" supports SVG),
273-
url(jewel-v0.woff2) format("woff2" supports COLRv0),
270+
src: url(jewel-v1.woff2) format("woff2") tech(color-COLRv1),
271+
url(jewel-svg.woff2) format("woff2") tech(color-SVG),
272+
url(jewel-v0.woff2) format("woff2") tech(color-COLRv0),
274273
url(boring.ttf) format("woff2");
275274
}
276275
```
@@ -281,15 +280,21 @@ as follows:
281280
/* 2. prefer Graphite over OpenType layout, if supported */
282281
@font-face {
283282
font-family: rare;
284-
src: url(rare-graphite.otf) format("opentype" supports features(graphite)),
285-
url(rare.otf) format("opentype" supports features(opentype)),
283+
src: url(rare-graphite.otf) format("opentype") tech(features-graphite),
284+
url(rare.otf) format("opentype") tech(features-opentype),
286285
url(fallback.ttf) format("truetype");
287286
}
288287
```
289288

290289
### Use Case 3: Detectability
291290

292-
The wording of the current specification currently reads:
291+
Two solution exist for detectability.
292+
One is the addition of [`font-tech()` function to CSS Conditional 5](https://drafts.csswg.org/css-conditional-5/#at-supports-ext).
293+
If this is not available,
294+
the parsing result of the `tech()` function in the src line
295+
can be used for feature detection.
296+
297+
The wording of the specification reads:
293298

294299
> If a component value is parsed correctly and is of a format and font
295300
> technology that the UA supports, add it to the list of supported sources. If
@@ -307,7 +312,7 @@ knowledge about technology support can be retrieved.
307312
<style>
308313
@font-face {
309314
font-family: a;
310-
src: url(/FEATURETESTVAR) format(woff2 supports variations);
315+
src: url(/FEATURETESTVAR) format(woff2) tech(variations);
311316
}
312317
</style>
313318
<script>

0 commit comments

Comments
 (0)