Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[css-fonts-4] How to handle math functions in font feature value declarations? #11261

Open
cdoublev opened this issue Nov 22, 2024 · 0 comments
Labels
css-fonts-4 Current Work

Comments

@cdoublev
Copy link
Collaborator

The value of a font feature value declaration is internally stored and exposed as unsigned integer(s) (spec).

But math functions are accepted in any context, unless otherwise specified, and are resolved at computed value time or later. So what is the expected output below?

const sheet = new CSSStyleSheet
sheet.insertRule(`
  @font-feature-values name {
    @annotation {
      boxed: calc(1em / 1em);
    }
  }
`)
sheet.cssRules[0].annotation.get('boxed'); // ???

I see 3 options:

  1. []: disallow math functions in font feature value declarations (by defining them with <number-token> whose type should be integer, instead of <integer>)
  2. [1]: resolve math functions at parse time in font feature value declarations (assuming relative length can be resolved, #10853)
  3. calc(1em / 1em): deal with CSSOMStrings instead of unsigned longs

I have a preference for 3. Even if math functions might not be useful in this context, 1 is restrictive and 2 is static. Besides, with @view-transition/types, they are the only descriptors whose attribute getter do not return a CSSOMString.

@cdoublev cdoublev added the css-fonts-4 Current Work label Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
css-fonts-4 Current Work
Projects
None yet
Development

No branches or pull requests

1 participant