W3C home > Mailing lists > Public > public-css-archive@w3.org > September 2016

Re: [csswg-drafts] [css4-fonts] support for OpenType font variations

From: Bram Stein via GitHub <sysbot+gh@w3.org>
Date: Tue, 20 Sep 2016 09:08:48 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-248246352-1474362525-sysbot+gh@w3.org>
I'm a little worried this is overloading the @font-face syntax too 
much. Families are created using multiple @font-face rules, one for 
each "instance". A variation font already contains all variations, so 
it doesn't map very cleanly to @font-face. The new format hints and 
range proposals feel a little off to me for that reason.

I know this would be a substantial change, but would it be possible to
 define a new @ rule for variation fonts? Something like this:

```css
@font-variation {
  font-family: BodyText;
  src: url(bodytext-vf.woff2) format("woff2"),
       url(bodytext-vf.woff) format("woff");
}
```

This avoids extending the format hints and overloading the @font-face 
descriptors. As @nattokirai pointed out, most uses of variation fonts 
won't need weight, style, and stretch descriptors.

```css
@font-face {
  font-family: BodyText;
  font-weight: normal;
  src: url(bodytext-normal.woff2) format("woff2"),
       url(bodytext-normal.woff) format("woff");
}

@font-face {
  font-family: BodyText;
  font-weight: bold;
  src: url(bodytext-bold.woff2) format("woff2"),
       url(bodytext-bold.woff) format("woff");
}

@font-variation {
  font-family: BodyText;
  src: url(bodytext-vf.woff2) format("woff2"),
       url(bodytext-vf.woff) format("woff");
}
```

This would fall back to the two @font-face rules in browsers that do 
not support font variations. Browsers that support font variations 
would ignore the @font-face rules and use the @font-variation rule for
 everything.

For `font-stretch` I would prefer an integer range instead of a 
percentage. This allows the use of `calc` and makes the behaviour 
similar to the proposed `font-variation-settings`.

-- 
GitHub Notification of comment by bramstein
Please view or discuss this issue at 
https://github.com/w3c/csswg-drafts/issues/498#issuecomment-248246352 
using your GitHub account
Received on Tuesday, 20 September 2016 09:08:57 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:41:03 UTC