[csswg-drafts] Computing font-relative units in font-* properties (#11629)

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

== Computing font-relative units in font-* properties ==
A bit of an odd case resulting from my attempt at implementing @Lorp’s [`font-optical-sizing: <number>` proposal](https://github.com/w3c/csswg-drafts/issues/4430) with current CSS capabilities:

```
:root {
  --ratio: 1
}

* {
  font-optical-sizing: 'opsz' calc(tan(atan2(1em * var(--ratio), 1px))); 
}
```

A Chrome developer [pointed](https://issues.chromium.org/issues/392317688#comment6) in a bug report that, technically, [the spec says](https://drafts.csswg.org/css-values-4/#font-relative-lengths):

> "When used in the value of any font-* property on the element they refer to, the font-relative lengths resolve against the computed metrics of the parent element—​or against the computed metrics corresponding to the initial values of the font and line-height properties, if the element has no parent." 

Currently, as far as I can tell, it’s only the `font-size` and `font` shorthand that accept `<length>`s, so would it make sense to narrow down on `font-size` and `font` instead of `font-*` in this paragraph? With CSS gaining the ability to produce `<number>`s, it may be beneficial to allow `1em` to refer to the current font size in most cases, including some `font-*` properties. 

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


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

Received on Friday, 31 January 2025 10:33:29 UTC