W3C home > Mailing lists > Public > www-style@w3.org > January 2012

[css3-fonts] Re: Adding a font to the current stack (smarter fallbacks)

From: John Daggett <jdaggett@mozilla.com>
Date: Wed, 11 Jan 2012 20:25:05 -0800 (PST)
To: Sylvain Galineau <sylvaing@microsoft.com>
Cc: www-style@w3.org, Matthew Wilcox <elvendil@gmail.com>
Message-ID: <daaddfd2-fb2a-4ec9-b294-53e24dc8a31b@zimbra1.shared.sjc1.mozilla.com>
Sylvain Galineau wrote:

> I suspect what you might want is something equivalent to an
> @font-face descriptor to define a font stack. Just for the purpose
> of illustration and using made-up syntax, I think you’re
> conceptually asking for: 
> 
> @font-face { 
>   font-family: base-sans-serif; 
>   stack : MelbourneRegular, "Helvetica Neue", Helvetica, Arial, sans-serif; 
> } 
> 
> html { font : 125%/1.3 base-sans-serif; } 
> #special { font-family : LeagueGothicRegular, base-sans-serif; } 
> 
> Is that right ?

I should point out here that for this case, where the author is using a font stack
to deal with cross-platform font matching rather than a combination of different
scripts like Latin, Arabic, Japanese, you can *already* use the src local syntax
to get something close:

@font-face { 
  font-family: base-sans-serif; 
  src: local(MelbourneRegular), local(HelveticaNeue), local(Helvetica), local(Arial), local(ArialMT);
} 

#special { font-family : LeagueGothicRegular, base-sans-serif, sans-serif; }

You'd need to do this for each style combination (e.g. normal, bold,
italic, etc.).  Not as simple as some form of variable substitution
but it'll work now.

> An extension to @font-face would not solve the general problem of
> CSS value lists redefinitions, but since fonts already have an
> indirection mechanism, something like this may be an option. (Though
> I suspect John Daggett may have 79 reasons I should be ashamed of
> myself for suggesting such a thing…)
> 
> Otherwise it sounds like something Variables might be able to tackle? 

Yeah, I think some form of variable substitution is the right way to
go here rather than extending @font-face, since you really are looking
to substitute *families* rather than individual fonts.

Cheers,

John Daggett
Received on Thursday, 12 January 2012 04:28:03 GMT

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