Re: [csswg-drafts] [css-fonts-4] [varfont] Problem setting up a "4-style family" with variable fonts

The [CSS Fonts 3](https://drafts.csswg.org/css-fonts/) spec includes a well-defined mechanism for dealing with pre-initialized settings for OpenType Layout features when defining a font via `@font-face`. The `font-feature-settings` keyword can be used as a **descriptor** within the `@font-face` rule, so it’s possible to specify: 

```
@font-face {
        font-family: NotoSansCJK;
        src: url("NotoSansCJK.ttf");
        font-style: normal;
}

@font-face {
        font-family: NotoSansCJK;
        src: url("NotoSansCJK.ttf");
        font-style: italic;
        font-feature-settings: "ital" 1; 
}
```

Here, upright and italic glyphs are embedded in a single font file, and the OpenType Layout feature `ital` is used to switch from the upright to italic forms. This syntax “maps” the `font-style: normal` CSS family variant to the default rendering of the font file, while it “maps” the `font-style: italic` CSS family variant to the same font file but with the OpenType Layout feature `ital` applied. 

Note that I don’t see `font-feature-settings` mentioned as a descriptor in the [CSS Fonts 4 draft](http://htmlpreview.github.io/?https://github.com/w3c/csswg-drafts/blob/master/css-fonts-4/Overview.bs) so I hope it’s not being removed. 

I think there is a legitimate case to also allow `font-variation-settings` as a descriptor within `@font-face`. This would allow for the following mechanism to work: 

```
@font-face {
        font-family: NotoSansCJK;
        src: url("NotoSansCJK-VF.ttf");
        font-style: normal;
}

@font-face {
        font-family: NotoSansCJK;
        src: url("NotoSansCJK-VF.ttf");
        font-style: italic;
        font-variation-settings: "ital" 1; 
}
```

The same mechanism should be used for the non-numeric `font-weight` properties, i.e. I should be allowed to say: 

```
@font-face {
        font-family: NotoSansCJK;
        src: url("NotoSansCJK-VF.ttf");
        font-weight: normal;
        font-variation-settings: "wght" 321; 
}

@font-face {
        font-family: NotoSansCJK;
        src: url("NotoSansCJK-VF.ttf");
        font-weight: bold;
        font-variation-settings: "wght" 834; 
}
```

The numeric `font-weight` values would still be “hardlinked” to the numeric `wght` variation axis values, but the non-numeric `font-weight` values could be pre-mapped to arbitrary numeric `wght` variation axis if `font-variation-settings` is used as a descriptor within `@font-face`. 

-- 
GitHub Notification of comment by twardoch
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/1289#issuecomment-297095437 using your GitHub account

Received on Tuesday, 25 April 2017 16:59:02 UTC