Skip to content

[css-fonts] Named instances and collections #6600

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

Open
litherum opened this issue Sep 10, 2021 · 3 comments
Open

[css-fonts] Named instances and collections #6600

litherum opened this issue Sep 10, 2021 · 3 comments
Labels
css-fonts-4 Current Work

Comments

@litherum
Copy link
Contributor

litherum commented Sep 10, 2021

Named instances and collections are conceptually similar: they both allow a single file to hold a finite set of faces, where each face has a name. However, in CSS they are currently triggered using wildly different mechanisms:

For font collections, you say:

@font-face {
    font-family: AMemberOfACollection;
    src: url("aFontCollection.ttc#TheMemberIWant");
}

For named instances, you say:

@font-face {
    font-family: ANamedInstance;
    src: url("aVariableFont.ttf");
    font-named-instance: TheNamedInstanceIWant;
}

I think we have 3-4 options:

  1. Keep it like it is
  2. Allow named instances to be specified in the fragment of the src URL
    2b. Delete font-named-instance entirely since it's unimplemented, and say the only way to use named instances is in the fragment of the src URL
  3. Allow the postscript name of a member in a collection to be supplied to font-named-instance
@litherum litherum added the css-fonts-4 Current Work label Sep 10, 2021
@litherum
Copy link
Contributor Author

Thinking about this, we may actually have accidentally implemented option 2 in the Apple ports of WebKit, just because of how platform APIs expose named instances.

@litherum litherum changed the title Named instances and collections [css-fonts] Named instances and collections Sep 10, 2021
@litherum
Copy link
Contributor Author

litherum commented Sep 10, 2021

My natural thought would be to do option 2 and 3 (but not 2b). And, if content uses a URL fragment but not font-named-instance, expose the URL fragment in the CSSOM and the CSS Font Loading API under the font-named-instance key. And if an author supplies both, then font-named-instance wins.

@litherum
Copy link
Contributor Author

@svgeesus @drott @jfkthame

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