W3C home > Mailing lists > Public > www-style@w3.org > November 2010

Re: @font-feature-values rule syntax

From: Christopher Slye <cslye@adobe.com>
Date: Mon, 15 Nov 2010 23:56:47 -0800
CC: "www-style@w3.org" <www-style@w3.org>
Message-ID: <77854F9A-BCF8-498F-AE53-626351E9DCC4@adobe.com>
To: John Daggett <jdaggett@mozilla.com>
I'm getting concerned that this is too complex and unintuitive. I've remarked before that this is something for "type nerds", so the intended audience can withstand some complexity -- but still, I continue to find the syntax daunting (and I am a type nerd). I have to stare at the code and recall everything every time I see it.

One thing that throws me is the order of the various tokens, e.g.

  font-variant: name index; /* e.g. swash: swishy 1 */

My brain wants it to be:

  name: font-variant index; /* e.g. swishy: swash 1 */

In my head, I think, "The <name> is <feature>'s <index 1>".

In fact, I am also desperately trying to think of a way to simplify the syntax overall. What if the @rules were used to define feature names and their font associations, rather than feature associations for a single font? For example:

@font-feature swishy {
   font-variant: swash;
   font-index: MyriadPro 1, MinionPro 3;
}
@font-feature alt-g {
   font-variant: stylistic;
   font-index: MyriadPro 2, MinionPro 1;
}

This "reads" better for me; it says something like, "Define this <name>. It's this kind of <feature>, and it's found in each <font>'s feature <index>."

Forgive me, I'm thinking out loud and using hastily-formed syntax just to get my point across.

-Christopher


On Nov 14, 2010, at 4:49 PM, John Daggett wrote:

> During the CSS WG discussion at TPAC [1], the topic of the syntax of
> the @font-feature-values rule [2] was discussed (see original proposal
> here [3]). This rule has been proposed as a way to deal with the
> problem of font-specific numbers used in conjuction with some values
> of font-variant (e.g. styleset, swash).
> 
> A example showing various aspects of the existing proposed syntax:
> 
>  @font-feature-values Jupiter Sans {
>    swash: swishy 1, flowing 2;
>    stylistic: long-k 2;
>    styleset: alt-g 1, alt-m 3;
>    styleset: curly-quotes 5, code-forms 4 7 9;  /* additional values */
>  }
> 
>  body { font-family: Jupiter Sans, GreatJapaneseFont, sans-serif; }
>  h2 { font-variant-alternates: styleset(alt-m, curly-quotes); }
>  h2:first-letter { font-variant-alternates: swash(flowing); }
> 
>  code { font-variant-alternates: styleset(code-forms); }
>  p { font-family: Another Lovely Font; }
> 
> Here the @font-feature-values rule defines values for font-specific
> alternates of a single font.  When fallback occurs those values are
> ignored unless the same value name has also been defined for the
> fallback fonts.
> 
> One point that was made during the F2F discussion was that the
> additive way these value definitions worked was different from the way
> normal CSS style rules function:
> 
>  p {
>    color: red;
>    color: blue; /* overrides the property set above */
>  }
> 
> Two alternative syntax proposals were made to work around this.
> 
> Proposal 1: use curly braces to define scopes for specific value definitions:
> 
> @font-feature-values Jupiter Sans {
>  swash {
>    swishy: 1;
>    flowing: 2;
>  }
>  stylistic {
>    long-k: 2;
>  }
>  styleset {
>    alt-g: 1;
>    alt-m: 3;
>    curly-quotes: 5;
>    code-forms: 4 7 9;
>  }
> }
> 
> Proposal 2: use @-marks next to font-specific value names rather than a colon:
> 
>  @font-feature-values Jupiter Sans {
>    @swash swishy 1;
>    @swash flowing 2;
>    @stylistic long-k 2;
>    @styleset alt-g 1;
>    @styleset alt-m 3;
>    @styleset curly-quotes 5;
>    @styleset code-forms 4 7 9;
>  }
> 
> The first proposal is somewhat verbose but it does remove some of the
> confusion of the initial proposed syntax.  The @-syntax makes the
> notation more compact but it feels a little bit like assembler macros.
> 
> Questions/comments?
> 
> Regards,
> 
> John Daggett
> 
> [1] http://www.w3.org/2010/11/02-CSS-minutes.html#item03
> 
> [2] http://dev.w3.org/cvsweb/~checkout~/csswg/css3-fonts/Fonts.html?rev=1.37&content-type=text/html;%20charset=utf-8#font-feature-values
> 
> [3] http://lists.w3.org/Archives/Public/www-style/2010Sep/0473.html
> 
Received on Tuesday, 16 November 2010 07:57:22 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:34 GMT