-
Notifications
You must be signed in to change notification settings - Fork 711
[css-fonts-4] font-feature-settings don’t cascade #552
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
Comments
Two comments here:
|
@dbaron Yeah, the |
And this is one reason I would like to see other browsers coming up to the same level that Firefox has on Which is not to say that the additive cascade idea isn't needed. |
I'd chime in here that even as someone who is pretty familiar with using OT features on the web, I had opted for font-feature-settings because I saw it as more widely supported and didn't know the difference until a half-hour ago between them and That said I've promised @litherum to mend my ways and learn the difference and write about it. If it was supported and we had more people writing about it (raises hand) then we'd be able to achieve what @nicksherman wants by something like this, right?
|
@jpamental No. Read up on @font-feature-values MyFont {
@styleset { my-keyword: 1; another-keyword: 2; }
}
div { font-variant-alternates: styleset(my-keyword);}
p { font-variant-alternates: styleset(another-keyword);} |
Thanks @Crissov - I had missed that first part ( That said, it does seem if |
Yes |
WebKit doesn't implement |
I didn’t see this discussion before, but if other people find it looking for a solution in the meantime, this one of the reasons I made Utility OpenType which mitigates this somewhat with CSS feature qeuries: .liga {
/* Gracefully degrade to `font-feature-settings` to
* avoid disrupting the OpenType feature cascade
* when possible. */
@supports not (font-variant-ligatures: common-ligatures) {
font-feature-settings: "liga";
}
/* IE doesn’t support @supports; explicitly use
* the prefixed version. */
-ms-font-feature-settings: "liga";
/* Best case scenario, just use `font-variant-*`. */
font-variant-ligatures: common-ligatures;
} This example is a bit contrived since ideally One other cascade-related issue I haven’t been able to get around is mixing A basic example: <style>
.calt { font-feature-settings: "liga", "calt"; }
</style>
<p class="calt">
<span>g</span><span>l</span><span>o</span><span>v</span><span>e</span><span>s</span>
</p> Even though the Contextual Alternates feature is applied to the paragraph, each letter in the For a weird but real-world example, I recently designed a sketch-y emoji/icon set for a magazine, and I made alternates for the icons. So, when they use it, if they use the same icon in a row, it uses a different alternate drawing so it looks more like a sketch: This is using the Contextual Alternates feature (which I turn off and then on again when I highlight the text in that gif) and works great. The other designer I was working with designed a layout that changed the colour of each of these glyphs. This isn’t a problem if they are all the same: …but once you wrap each in a I’m not even sure if this would be considered incorrect, but it definitely seems related to the question of how the cascade of OpenType features works or should work. |
@kennethormandy I believe the Perhaps the CSS spec should be more explicit about how user agents should handle contextual glyph substitution when there are spans involved. But that probably deserves its own separate issue. |
@nicksherman You mean like this? :) https://drafts.csswg.org/css-text-3/#boundary-shaping |
WebKit has an ancient bug about this: https://bugs.webkit.org/show_bug.cgi?id=6148 |
@litherum Good to know, thanks! Perhaps this issue/discussion about features breaking between spans should move to another thread though, since this one was originally about cascading font-feature-settings :) |
Closing this one as WONTFIX: this is a known problem with |
Currently, font-feature-settings cancel each other out, making it impossible to apply them with abstract logic.
For example, say I want to achieve the following:
div
uses stylistic set 1.p
uses stylistic set 2.p
inside adiv
uses both stylistic sets 1 and 2.Currently, this requires some repetition:
div { font-feature-settings: "ss01";}
p { font-feature-settings: "ss02";}
div p { font-feature-settings: "ss01", "ss02";}
Ideally – keeping in the cascading spirit of CSS – font-feature-settings could be inherited and combined, avoiding redundancy while allowing more logical abstraction. Like so:
div { font-feature-settings: "ss01";}
p { font-feature-settings: "ss02";}
The text was updated successfully, but these errors were encountered: