Skip to content

[css-fonts-4] Reconcile feature-value index restrictions with prose and implementations #14657

Done

Description

@domenic

(Written with help from GPT-6 Astra High.)

The grammar added after #9926 restricts @styleset indexes to 0–20 and requires two @character-variant indexes, with the first limited to 0–99. But the multi-valued feature prose still says large styleset indexes parse successfully and have no rendering effect; its example uses dumb: 125.

All three engines accept the values excluded by the newer grammar:

const sheet = new CSSStyleSheet();
sheet.replaceSync(`@font-feature-values Example {
  @styleset { a: 120 124; }
  @character-variant { b: 0; c: 111; d: 111 13; }
}`);
console.log(sheet.cssRules[0].cssText);
// Chromium 151, Firefox 153, WebKit 26.5: all four declarations are retained.
// Formatting and block order differ between engines.

The existing WPT parsing test also requires retaining these declarations.

We could preserve this behavior by changing the parsing requirements to:

  • Each @styleset declaration must match <font-feature-index [0,∞]>+.
  • Each @character-variant declaration must match <font-feature-index [0,∞]>{1,2}. If only one index is supplied, the feature's selected value defaults to 1.
  • Whether an index names an available OpenType feature is handled when applying the declaration, rather than by rejecting otherwise valid integer syntax.

This would retain the cardinality restrictions discussed in #9926 while separating syntax validity from the available OpenType feature identifiers.

Either way, the rendering prose and examples should be reconciled with whichever grammar is chosen.

Activity

  1. self-assigned this
    on Oct 27, 2026
  2. added
    spec-test-mismatch
    on Nov 20, 2026
  3. svgeesus commented on Nov 20, 2026

    @svgeesus
    Collaborator

    I agree that there is no good reason to arbitrarily restrict these numbers, and so adjusting the spec prose to align with implementations and WPT is the correct course here.

    Want to make a PR with those updated parsing requirements?

  4. added a commit that references this issue on Dec 3, 2026
  5. svgeesus commented on Dec 3, 2026

    @svgeesus
    Collaborator

    Fixed in 2cae9fa. Thanks @domenic for the clear report.

    The parsing requirements now match implementations and WPT:

    • @styleset declarations match <font-feature-index [0,∞]>+
    • @character-variant declarations match <font-feature-index [0,∞]>{1,2}; if only one index is given, the value passed for the feature is 1
    • Whether an index names an available OpenType feature no longer affects whether the declaration is valid; it only matters when the declaration is applied

    The prose and examples are updated to match, so out-of-range indexes are described as valid but enabling no feature.

    Separately, 1c6be96 corrects the @swash example, which referred to ss05 and ss02 rather than swsh and cswh.

  6. added
    Closed Accepted as Obvious Bugfix
    and removed
    spec-test-mismatch
    on Dec 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Closed Accepted as Obvious Bugfixcss-fonts-4

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions