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

Re: @font-face, Font Families and Computed Values ?

From: John Daggett <jdaggett@mozilla.com>
Date: Mon, 23 Mar 2009 21:58:02 -0700 (PDT)
To: Faruk Ateş <faruk@apple.com>
Cc: www-style@w3.org
Message-ID: <7013443.154921237870682459.JavaMail.root@cm-mail02.mozilla.org>
> Faruk Ateş wrote:
> > You're confusing "computed value" (which is a construct primarily of
> > use in handling properties with "inherit" values or that inherit by
> > default) and "used value" (which tells you what really happened).
> > I'd think that you'd really want to inherit font-family "as
> > specified".  Anything else leads to pretty bizarre behavior...
> 
> It would appear so, yes. I guess I was expecting Computed Value to
> "be" the Used Value since there is no "getUsedValue" method or
> anything of that kind, as far as I'm aware? In other words, I'm
> essentially asking for something that just flat out doesn't exist in
> any spec nor User Agent.

Yup, doesn't exist.  Keep in mind that a given run of text can end up
mapping to a set of actual fonts, not just a single font.

But I still think there's a valid issue here, current implementations
return completely different results for the computed value of
font-family.

Example (http://people.mozilla.com/~jdaggett/fontfamily-getcomputedstyle.html): 

  p { font-family: Burpy Bongo, Helvetica Neue, sans-serif; }
  
  <p>&#xfdfa; testing, tra la!</p>

The computed value font-family for the <p> element:

  Webkit trunk: 'Burpy Bongo'
  Opera 10: "Helvetica Neue"
  FF 3.0: Burpy Bongo,Helvetica Neue,sans-serif

So Webkit is returning the first font in the list, whether it exists or
not, with single quotes wrapped around family names containing spaces. 
Opera 10 returns the first available font in the list, wrapped in double
quotes.  Firefox 3.0 returns the entire list, stripped of white space
between family names.

The actual fonts used are Al Bayan and Helvetica Neue under Mac OS X.

I think the Firefox behavior is actually the closest to the spirit of
the spec, it's telling you what the computed value of the style property
is *not* attempting to calculate the used value.  Whether normalized
names are allowed or disallowed should be spelled out more clearly. 
Font families defined with @font-face rules are the same as missing
families for user agents that don't support @font-face.

John Daggett
Mozilla Japan
Received on Tuesday, 24 March 2009 04:58:42 GMT

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