Re: [csswg-drafts] [css-fonts-4] `font-variant-alternates` implementation (#5799)

There is an example (57) for why this is useful:

~~~~ css
@font-feature-values Otaru Kisa {
  @annotation { circled: 1; black-boxed: 3; }
}
@font-feature-values Taisho Gothic {
  @annotation { boxed: 1; circled: 4; }
}

h3.title {
  /* circled form defined for both fonts */
  font-family: Otaru Kisa, Taisho Gothic;
  font-variant: annotation(circled);
}
~~~~

However, if it was specified anew nowadays, I would expect it to look something like this instead:

~~~~ css
@font-face Otaru Kisa {
  --circled: 1;
  --black-boxed: 3;
}
@font-face Taisho Gothic {
  --boxed: 1; 
  --circled: 4;
}

h3.title {
  /* circled form defined for both fonts */
  font-family: Otaru Kisa, Taisho Gothic;
  font-variant-annotation: var(--circled); /* not font-variant-alternates: annotation(circled) */
}
~~~~

Also, [OpenType supports naming](https://docs.microsoft.com/en-us/typography/opentype/spec/name) most if not all of the indices that can be named with `@font-feature-values`.

> the [`@font-feature-values`](https://drafts.csswg.org/css-fonts-4/#at-ruledef-font-feature-values) rule is used to define values for a specific font family or set of families that associate a font-specific **numeric** `<feature-index>` with a custom [`<feature-value-name>`](https://drafts.csswg.org/css-fonts-4/#feature-value-name-value), which is then used in this property to select specific alternates

Maybe it would make sense to support such strings as well.

~~~~ css
  font-variant-annotation: "circled forms";
~~~~

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


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

Received on Tuesday, 25 May 2021 14:48:02 UTC