w3c / w3c/csswg-drafts

[css-fonts] Computed value of font-feature-settings

Open
#8,296 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

css-fonts-4
Dominant language
Bikeshed
Stars
4.9k
Forks
816
PR merge metrics
PR metrics pending

Description

The current text of CSS Fonts 4 seems to contradict itself here.

On the one hand, 6.12 says

Computed value: as specified

Suppose the specified value is

font-feature-settings: "abcd", "spqr", "abcd" 2;

Note that the "abcd" feature has been specified twice, first with the implied value of 1, and later with an explicit value of 2.

So what is the computed value of font-feature-settings? If it's "as specified", then it should be exactly this list of three features, including both entries for "abcd".

However, the text goes on to say, a few paragraphs later,

The computed value of font-feature-settings is a map, so any duplicates in the specified value must not be preserved. If the same axis name appears more than once, the value associated with the last appearance supersedes any previous value for that axis.

Currently, of the browsers I've tried, only Safari appears to do this, returning "spqr", "abcd" 2 from getComputedStyle; both Firefox and Chrome return the list "as specified" including the first (superseded) occurrence of "abcd".

We should confirm which behavior is wanted ("as specified" or "with duplicates removed"), and adjust the spec accordingly. (My inclination is to require the duplicate-removal behavior, as implemented in Safari, so that would imply Firefox and Chrome should fix their bugs here.)

(Note that the similarly-structured font-variation-settings property defines its computed value differently:

Computed value: the keyword 'normal' or a list, each item a string paired with a number

It then has similar text confirming that duplicates should be removed:

If the same axis name appears more than once, the value associated with the last appearance supersedes any previous value for that axis. This deduplication is observable by accessing the computed value of this property.

So maybe a similar computed value description should be used for font-feature-settings, instead of "as specified".)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read CSS Fonts 4 §6.12 and the linked font-variation-settings definition, then compare their computed-value wording with the duplicate-handling prose. Check the reported getComputedStyle behavior in Safari, Firefox, and Chrome. Done means the Working Group has resolved the intended behavior and the specification text is consistent with that decision.

Written by the indexing model from the issue text.

Assessment

Tech stack
css
Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.