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

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 UTC