w3c / csswg-drafts

CSS Working Group Editor Drafts
https://drafts.csswg.org/
Other
4.5k stars 660 forks source link

[css-fonts] How should relative-length values be interpreted when used in @font-face descriptors? #10876

Open weinig opened 1 month ago

weinig commented 1 month ago

How should relative-length values be interpreted when used in @font-face descriptors?

The grammars for @font-face descriptors, for example, 'size-adjust', allow the use of relative-length values due to the fact that calc() allows for them.

For example, using 'size-adjust' again:


@font-face {
   size-adjust: calc(50% * sign(10em - 2px));
}

So the question is, what does 10em evaluate to? @font-palette-values contains this text:

Math functions, such as calc(), and also var(), and env(), are valid within descriptor values in a @font-palette-values rule. They are evaluated within the context of the root element. Relative units are also evaluated within the context of the root element.

but I can't find any similar text for @font-face.

svgeesus commented 1 month ago

I suggested that we try to solve this centrally rather than replicate the text everywhere it crops up (or should crop up). Only if a particular case needs an exception to the general rule should it be mentioned.