Bug 18002 - @font-face { src: local("font"); } matches font family, not full face name
Summary: @font-face { src: local("font"); } matches font family, not full face name
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.5
: P2 Normal
Assignee: Nobody
URL: http://blog.lordsutch.com/archives/4013
Keywords:
Depends on:
Blocks:
 
Reported: 2008-03-21 20:57 PDT by Chris Lawrence
Modified: 2011-10-19 21:15 PDT (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Lawrence 2008-03-21 20:57:48 PDT
Section 2.5 of the CSS3 Web Fonts specification (http://www.w3.org/TR/css3-webfonts/#referencing) says, in part:

"The locally-installed <font-face-name> is the full font name of a locally installed font. The full font name is the name of the font as reported by the operating system and is the name most likely to be used in reader style sheets, browser default style sheets or possibly author style sheets on an intranet. Adornments such as bold, italic, and underline are often used to differentiate faces within a font family. For more information about full font names please consult the notes below."

and one example is:

"src: local("BT Century 751 No. 2 Semi Bold Italic")
    references a particular face of a locally installed font"

However, a stylesheet (such as the one referenced by the page above, found at http://blog.lordsutch.com/fonts/faces.css) that specifies the full face--e.g. "DejaVu Sans Bold Oblique"--using the local("") syntax does not match a font and downloads the font at the lower priority URI.  Safari 3.1 and the nightly (at least on OS X 10.5.2) only recognizes as locally-installed fonts specified by their family name, which seems incorrect and likely to lead to interoperability problems, as the family name alone might be matched by other browsers to the normal-weight, normal-slant variant of the typeface.

(The current stylesheet contains both the correct specification and that recognized by Safari/Webkit, as I'd rather every Safari user not download 2 MB of fonts when visiting my site for the first time even if they are already locally-installed.)
Comment 1 Dave Hyatt 2008-03-24 12:29:56 PDT
"and is the name most likely to be used in reader style sheets" makes me think WebKit's current behavior is correct...
Comment 2 Chris Lawrence 2008-03-25 02:38:35 PDT
On the other hand, section 3.2 (http://www.w3.org/TR/css3-webfonts/#aname) says:

"3.2. Full font name

This is the full name of a particular face of a font family. It typically includes a variety of non-standardized textual qualifiers or adornments appended to the font family name. It may also include a foundry name or abbreviation, often prepended to the font family name. It is only used to refer to locally installed fonts, because the format of the adorned name can vary from platform to platform. It must be quoted."

The "full name of a particular face" part, along with the discussion of "adornments appended to the font family name," suggests to me that it should be the "full name" of the font face, not just the family name.

Also, in section 2.5 it refers only to "reader style sheets,
browser default style sheets or possibly author style sheets on an intranet" - not to *author* style sheets.

Further I think that S. 2.5 is trying to say something like "@font-face rules in reader style sheets, browser default style sheets, or possibly author style sheets on an intranet will typically use local()" (since you wouldn't really want to download your default fonts from a remote URI every time you launch the browser or hardcode local font paths, e.g. url("file:///Library/Fonts/GillSans.dfont"), in a stylesheet), rather than saying anything about font-family properties outside of @font-face rules.
Comment 3 Dave Hyatt 2008-04-07 10:36:38 PDT
You need to be able to target specific variants via local() in order to be able to test for missing variants of a specific font family.  The question is whether or not using the parameters in the @font-face declaration are good enough for this purpose.
Comment 4 Nicholas Shanks 2008-08-27 10:54:07 PDT
I think the specification is in error, and the font name in @font-face rules should be the family name as currently implemented in WebKit. The other declarations in the @font-face block determine what face is represented within that family.
Comment 5 John Daggett 2008-08-27 12:10:27 PDT
The local() syntax specifies a face, not a family.  And Safari does support the syntax but only via Postscript names on Mac OS X, not full font names:

@font-face {
  font-family: Ornaments;
  src: local(HoeflerText-Ornaments);
}

This is more an artifact of Mac font API's.
Comment 6 Nicholas Shanks 2008-08-27 15:14:38 PDT
Ah yes, sorry. I was confusing myself while reading this bug and getting the src and font‐family properties muddled.
Comment 7 Tab Atkins 2011-10-19 21:15:27 PDT
It looks like this in INVALID, then, since the behavior difference is due to different font APIs on Mac, not a misimplemented feature.  You can indeed select a particular face with local(), you just have to use a different name on Safari/Mac than on other platforms.

(It makes me sad that face names are so hard to select properly, but there's not a lot we can do now, since we're dependent on the platform APIs.)