w3c / w3c/csswg-drafts

[css-fonts-4] [varfont] Allow access to named instances outside of @font-face

Open
#2,972 5 comments 4 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

#525 added access to named instances by specifying font-named-instance in @font-face.

For other aspects of a variable font you can specify on @font-face OR elsewhere. For example, font-variation-settings (https://drafts.csswg.org/css-fonts-4/#font-variation-settings-def) will let you use the font-face with different axis positions and font-display can be changed outside the @font-face with @font-feature-values (https://drafts.csswg.org/css-fonts-4/#font-display-font-feature-values).

Is it plausible that a mechanism be defined such that a font-named-instance be set outside of @font-face? Just allow font-named-instance in more places similar to font-variant-alternates?

For Google Fonts and other central services this would be very convenient: ask for a variable family and then access all sorts of fun parts of it. For example:

@import url('https://fonts.googleapis.com/css?family=Markazi+Text');

body { font-family: 'Markazi Text'; }

/* Here I can change axis positions (font-variation-settings) or set a font-display using @font-feature-settings but I can't change my axis positions using the named instances carefully defined by my type designer 😞 */
h1 { font-named-instance: 'Markazi Text Light'; }
h2 { font-named-instance: 'Markazi Text Bold'; }

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

Start with the CSS Fonts 4 draft and compare the existing font-named-instance proposal with font-variation-settings and font-feature-values. The issue asks whether named instances should be selectable outside @font-face; done would require a decided mechanism and corresponding specification text.

Written by the indexing model from the issue text.

Assessment

Tech stack
css
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.