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

Re: [css3-fonts] font-specific feature handling

From: fantasai <fantasai.lists@inkedblade.net>
Date: Thu, 18 Mar 2010 14:45:22 -0700
Message-ID: <4BA29EF2.3050201@inkedblade.net>
To: John Daggett <jdaggett@mozilla.com>
CC: www-style@w3.org
On 03/18/2010 02:01 PM, fantasai wrote:
>
> You may consider the problem unimportant, but there are several WG
> members that disagree. If @font-face rules are unnecessarily unweildy,
> design a better alternative. The feedback you've gotten is that
> font-specific settings should be tied to the font, because whether or
> not they're likely to fail gracefully, they have no consistent or
> predictable meaning across font faces: once fallback is triggered,
> you get a random result.

Just to give you something to kick around, here's one approach:

1. Use 'font-variant' descriptor to set variants for the font overall

@font-face {
   font-family: MyFancyFont;
   font-variant: stylistic(2,3);   /* alternate 'g' and 'W' forms */
}

@font-face {
   font-family: MyAwesomeMonospace;
   font-variant: styleset(1,5); /* more distinct l/1/I glyphs,
                                   capitalize esszet as Versal-Esszet */
}

2. Use @alt-set to define a named alternate set

@font-face {
   font-family: MyFancyFont;
   font-variant; stylistic(2,3) styleset(1,3);
   @alt-set swishy {
      styleset(7) /* swishy ascenders and descenders */
      swash(2)    /* swash caps set #2 */
   }
}

@font-face {
   font-family: MyAwesomeMonospace;
   font-variant: styleset(1,5);
   @alt-set swishy {
      styleset(4) /* more curvy, flourished glyph set */
   }
}

@font-face {
   font-family: Gabriola; /* Installed on Windows 7 machines */
   @alt-set swishy {
     styleset(5)
   }
}

3. Names sets, but not numbered settings, are allowed in font-variant property:

body {
   font-family: MyFancyFont, Gabriola, Monotype Corsiva, serif;
}
pre, code, samp {
   font-family: MyFancyMonospace, monospace;
}

h1, h2, h3, h4, h5, h6 {
   font-variant: alt-set(swishy);
   /* named set ignored where not defined: i.e. for Monotype Corsiva and the serif fallback */
}

<h1>All About <code>font-variant</code>!</h1>

<p>This body text is more subdued than the header.</p>

<pre>This code example matches the monospace font in the heading,
but is likewise more straightforward.</pre>

~fantasai
Received on Thursday, 18 March 2010 21:46:00 GMT

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