Skip to content

[css-fonts-5] Consider 'extends' descriptor to reduce duplicate declarations #6104

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
fantasai opened this issue Mar 16, 2021 · 6 comments

Comments

@fantasai
Copy link
Collaborator

CSS Counter Styles has an extends descriptor that basically copies all the descriptors of a different @counter-style rule and lets this @counter-style rule override specific ones rather than repeating them all. See https://www.w3.org/TR/css-counter-styles-3/#extends-system

It might make sense to copy that system over to @font-face, to make it easy to tweak the definitions of a common font face into multiple variants?

@svgeesus
Copy link
Contributor

Avoiding the maintenance headache of almost-the-same descriptor blocks sounds good in principle.

Should that be added as a general feature of @-rules or is it okay to just define it in @counter-style and @font-face (and potentially @ont-feature-values and @font-palette-values )?

@svgeesus
Copy link
Contributor

As a very weak counter-argument, SVG at one time had a feature in gradients to make them extend other gradients; which could lead to lengthy chains of gradients extending other gradients extending other gradients, and was not liked by implementers especially when animated.

(Of course, descriptors can't be animated)

@tabatkins
Copy link
Member

I don't think this should be a general feature; it's additional impl complexity that isn't particularly needed for most rules. But font-faces do the "multiple at-rules that are nearly identical" thing a lot more than counter-styles do, especially as we add more of these controlling descriptors.

@astearns
Copy link
Member

Is there any evidence that authors have found descriptor duplication in font-face rules annoying enough to have created tooling for this case?

@faceless2
Copy link

There was none found for #3691, which was something I floated a while back that had a similar goal.

@css-meeting-bot
Copy link
Member

The CSS Working Group just discussed [css-fonts-5] Consider 'extends' descriptor to reduce duplicate declarations.

The full IRC log of that discussion <dael> Topic: [css-fonts-5] Consider 'extends' descriptor to reduce duplicate declarations
<dael> github: https://github.com//issues/6104
<dael> fantasai: The @counter-style rules can get complicated. @extend lets you go off previous definition. As @font-face gets more complicated might be might to have same mech so a font-face rule can extend another one and add some descriptors
<dael> myles: I think I agree with astearns comment where we should wait for things like Sass to come up with it. A bit early to add b/c don't know we need it
<dael> astearns: And a lot of things we're adding to complicate rule are for specific fonts and not really shared. Don't want to get to state where someone uses a value they tested on one font on a lot where they don't know correct
<dael> fantasai: Yeah. When have variable font youll have a bunch of common stuff to core. might want to set some things to set named variants
<dael> astearns: Agree probably useful for variation fonts, but should wait until we know it'll be used
<dael> leaverou_: May not have seen sign complaints b/c authors copy/paste generated @font-face rules. Duplication is there
<fantasai> +1
<dael> myles: I understand we're discussing this bc adding rules. If we give them time to start using new things we'll hear noise about needing this. If not nec we won't
<dael> Rossen_: Hearing folks leaning toward waiting to see how and when it's needed
<dael> Rossen_: We'll put this on pause until have stronger signals

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants