csswg-drafts icon indicating copy to clipboard operation
csswg-drafts copied to clipboard

[css-fonts][css-font-loading] @font-face's font-variant descriptor vs. FontFace's variant attribute

Open foolip opened this issue 3 years ago • 3 comments

In https://github.com/w3c/csswg-drafts/commit/d3db8697852a6ccc1c8dafcb4aff1f516198bb50, the font-variant descriptor of the @font-face rule was dropped, resolving https://github.com/w3c/csswg-drafts/issues/2531.

However, the FontFace interface still has the variant attribute: https://www.w3.org/TR/css-font-loading-3/#fontface-interface

It's not clear if this is an oversight, or if it makes sense somehow. Should the descriptor be reinstated, or the attribute removed?

WebKit removed both https://github.com/WebKit/WebKit/commit/af1a8ee05741c91cfe065c3b8e695bb786eeb43f, leaving WebKit the only engine without FontFace's variant attribute, which is how I came to notice this.

cc @litherum @drott @svgeesus

foolip avatar Jul 15 '22 09:07 foolip

I should say also that I'm not sure I understand the relationship between the properties named font-variant-* and the descriptors, and if support for one implies support for the other. Hoping that experts can explain if there's a problem here or not :)

foolip avatar Jul 15 '22 09:07 foolip

In https://github.com/w3c/csswg-drafts/commit/d3db8697852a6ccc1c8dafcb4aff1f516198bb50, the font-variant descriptor of the @font-face rule was dropped, resolving https://github.com/w3c/csswg-drafts/issues/2531.

Right.

However, the FontFace interface still has the variant attribute: https://www.w3.org/TR/css-font-loading-3/#fontface-interface

I think that is easily explained: https://github.com/w3c/csswg-drafts/commit/d3db8697852a6ccc1c8dafcb4aff1f516198bb50 happening on Sep 20, 2019 while https://www.w3.org/TR/css-font-loading-3/#fontface-interface was published 22 May 2014 :( and badly needs to be republished

However the current ED also has the same problem and I agree, the descriptor was removed so the interface should remove it also.

svgeesus avatar Jul 15 '22 10:07 svgeesus

I'm not sure I understand the relationship between the properties named font-variant-* and the descriptors,

A descriptor says what a font can do, what it supports. A property is a request for styling, for some element. So for example a property can say "I want this text to be italic" and the descriptor says "this font supports italic" which means it is a candidate for being used. This is why properties and descriptors have the same names, but don't necessarily have the same value syntax. For example the font-weight descriptor can take two values:

font-weight: 300 650;

meaning it can produce that range of weights, while the font-weight property takes only a single value

font-weight: 700

which means it won't match that font; the font-weight property also takes values that make no sense for a descriptor, like bolder.

Properties and descriptors are not always paired. For example there is a unicode-range descriptor but no unicode-range property; the text content of the element sets what unicode characters it wants to render.

svgeesus avatar Jul 15 '22 10:07 svgeesus