by codyrobbins · 14y ago · 0 comments
But this syntax they’ve come up with is an absolute horrifying mess. Ugh. Please say it ain’t so!
font-feature-settings: "smcp=1”;
font-feature-settings: "swsh=1,cswh=1”;
Seriously—that’s how you get small caps and swash? Seriously?? These look like optimization flags for a C compiler, not CSS.I’m guessing that these are probably mapping through to the underlying OpenType features directly somehow to support arbitrary aspects of a particular type, but it still needs to be less of a mess for the “normal” stuff.
Why can’t it be something readable and self-documenting?
font-features: small-caps, contextual-swash; font-variant-caps: small-caps
...and contextual alternates (such as swashes) with: font-variant-alternates: contextual
If you want to configure a bunch of variations at once, there's a short-hand property: font-variant: contextual small-caps
The font-feature-settings option is only there for the wild and crazy OpenType features too esoteric to have CSS attributes. font-feature-settings: "kern" 1;
Actual implementations are currently CSS extensions as the functionality is not yet in a published spec.
Mozilla's CSS extension uses the syntax: -moz-font-feature-settings: "kern=1";
Microsoft's CSS extension however uses the same syntax as the current W3C draft, expect with the standard browser specific prefix used before a feature makes it into the official spec. -ms-font-feature-settings: "kern" 1;
Whether this syntax is ideal or not is still, imho, contestable. Either way it isn't Mozilla's parameter-esque style (which I agree stands very much in opposition to the usual CSS syntax style), and as long as the syntax in the draft reaches finalization, said parameter-esque syntax should go away for good.I don't see why a boolean value wasn't an option; the values is either defined or it's not. Otherwise "kern(1)" would have been more consistant with other properties.
font-caps: small; /* or none */
font-swash: contextual; /* or none */
This also gives room for future flexibility in values.http://en.wikipedia.org/wiki/List_of_typographic_features
As thristian points out, font-feature-settings should be a last resort for rarely-used features without a separate syntax. It is not meant to set all features down.