[csswg-drafts] [css-fonts-3] @font-face font-variant cannot easily be reverted to default

faceless2 has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-fonts-3] @font-face font-variant cannot easily be reverted to default ==
Lets say I have this in my stylesheet
```
@font-face {
    font-family: "Bickham";
    src: url(bickham.ttf);
    font-variant: historical-forms;
}
```
If I ever wanted to use the "Bickham" font *without* the historical forms - i.e. the default rendering of the font, with no features applied - I can't do this without resorting `font-feature-settings: "hist" 0;`

This seems like an oversight, particularly so if you're trying to encourage people to use the `font-variant-X` properties instead of `font-feature-settings`.  More generally, having a rule set in a stylesheet that cannot easily be overriden in a later stylesheet is just not very CSS.

Intuitively you might specify `font-variant: none` in the element's style, but "none" is only an option with font-variant-ligatures, where it works as expected. Adding a "none" option to font-variant-numeric, font-variant-alternates etc. that explicitly turns off any previously set features would be the obvious option -  however this would imply changing the behaviour of `font-variant: none`.

So might be an idea to add a new keyword like "reset" to the various `font-variant-X` properties (and `font-variant`). Or, perhaps, slightly redefine the `initial` value for these properties to also reset any values set in the @font-face rule. So our solution could look like this:

```
@font-face {
    font-family: "Bickham";
    src: url(bickham.ttf);
    font-variant: historical-forms;
}

.nonhistoric {
   font-variant: initial; /* implied font-variant-alternates: initial */
}
```

Or is this behaviour intentional?

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/2265 using your GitHub account

Received on Friday, 2 February 2018 15:22:03 UTC