[csswg-drafts] Clarify precedence of font-feature-settings descriptor and font-variation property (#7498)

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

== Clarify precedence of font-feature-settings descriptor and font-variation property ==
I've put a test up at https://jsbin.com/veqidew/edit?html,output, here it is too:

```html
 <style>
  @font-face {
    font-family: Lato-On;
    src: url("https://bfo.com/misc/Lato-Medium-Liga.ttf");
    font-feature-settings: 'liga' on;
  }
  @font-face {
    font-family: Lato-Off;
    src: url("https://bfo.com/misc/Lato-Medium-Liga.ttf");
    font-feature-settings: 'liga' off;
  }
  .feature-on {
     font-family: Lato-On;
  }
  .feature-off {
     font-family: Lato-Off;
  }
  .variation-off {
    font-variation-ligatures: none;
  }
  .variation-on {
    font-variation-ligatures: initial; /* = normal */
  }
  p {
    font-size: 100px;
    margin: 0;
  }
 </style>
 <body>
  <p class="feature-off variation-off">fi</p>
  <p class="feature-on variation-off">fi</p>
  <p class="feature-off variation-on">fi</p>
  <p class="feature-on variation-on">fi</p>
 </body>
```

The font precedence rules in both [Fonts-3](https://www.w3.org/TR/css-fonts-3/#feature-precedence) and [Fonts-4](https://www.w3.org/TR/css-fonts-4/#feature-variation-precedence) seem clear - we are to:

* apply the default rules
* apply the `font-feature-settings` descriptor
* apply the `font-variation` properties

Which means that we start with the "liga" feature on (the default), that's overridden by the `font-feature-settings` descriptor, and is then _always_ overridden by the `font-variation-ligatures` property - the initial value is "normal" which turns it on, or I can set to "none" which turns it off. But it will always change - there is no `font-variation-ligatures` value that means "don't change anything".

This means that the first two paragraphs of the test have no change, and the second two have a ligature.

Correct?

The reason I ask is that's not the behaviour in Webkit or Gecko, which give precedence to `font-feature-settings` (Blink doesn't support the descriptor). It's also not what's being tested in https://wpt.fyi/results/css/css-fonts/font-feature-resolution-001.html from where the above test was derived, which came from the Chromium team. So I have a nagging doubt I have misunderstood and would like to confirm before I raise a PR for that test.

Related: https://github.com/w3c/csswg-drafts/issues/4358 - I think this could be closed, or at least reduced to remove `font-feature-settings` given you've got two browsers implementing the descriptor.


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


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Thursday, 14 July 2022 19:29:50 UTC