w3c / w3c/csswg-drafts

[css-font-loading-3] Unclear how to parse font families

Open
#3,776 15 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

css-font-loading-3
Dominant language
Bikeshed
Stars
4.9k
Forks
816
Avg merge
2d 18h
Merged PRs (30d)
24

Description

https://drafts.csswg.org/css-font-loading-3/#font-face-constructor

Parse the family argument, and the members of the descriptors argument, according to the grammars of the corresponding descriptors of the CSS @font-face rule.

https://drafts.csswg.org/css-fonts-4/#family-name-syntax

Font family names other than generic families must either be given quoted as <string>s, or unquoted as a sequence of one or more identifiers.

So what if you have

new FontFace("4m", source)

It is neither a quoted string nor an unquoted sequence of one or more identifiers (identifiers can't start with a number), so WebKit throws an exception here. However, Chrome and Firefox treat the argument as if it was quoted.

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 the CSS Font Loading Level 3 font-face constructor section and the CSS Fonts Level 4 family-name syntax section. Compare the stated grammar with WebKit's exception and Chrome and Firefox's behavior for new FontFace("4m", source). Done means the specification clearly defines how this family argument is parsed.

Written by the indexing model from the issue text.

Assessment

Tech stack
css
Domain
documentation, web-dev
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.