google / google/fonts

Syntax question in font-face declarations for variable fonts in css2 API

Open
#2,170 12 comments 0 reactions 1 assignee Claimed by @nathan-williams View on GitHub
Dominant language
HTML
Stars
20.5k
Forks
2.9k
Avg merge
1d 21h
Merged PRs (30d)
95

Description

Hi there,

In digging in to the new API (announcement here for those who might not have seen it: https://codepen.io/nlwilliams/full/JjPJewp), I noticed that the `@font-face` syntax is a little out of sync with the spec. Not sure if there's a reason for this, so wanted to pose the question.

When specifying the format, it should be `format('woff2-variations')`, but the CSS being served specifices `format('woff2')`. It would be good to make sure it's following the spec, as others will look to this implementation to learn how to use them.

Example of current syntax:

```
@font-face {
font-family: 'Crimson Pro';
font-style: normal;
font-weight: 200 900;
src: url(https://fonts.gstatic.com/s/crimsonpro/v7/q5uDsoa5M_tv7IihmnkabARVoYF6CsKjnlQ.woff2) format('woff2');
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
```

should likely be:

```
@font-face {
font-family: 'Crimson Pro';
font-style: normal;
font-weight: 200 900;
src: url(https://fonts.gstatic.com/s/crimsonpro/v7/q5uDsoa5M_tv7IihmnkabARVoYF6CsKjnlQ.woff2) format('woff2-variations');
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.