From: Jukka K. Korpela (jkorpela@cs.tut.fi)
Date: Mon Apr 25 2005 - 23:53:39 CST
On Mon, 25 Apr 2005, Doug Ewell wrote:
> Most style sheets end their font-family lists with "serif" or
> "sans-serif," and I think if it gets to that point, the browser can be
> considered to have done its job if it picks (respectively) any old serif
> or sans-serif font its heart desires.
That's true, and that's one of the reasons why the official (W3C)
recommendation to use a generic font family name (such as serif or
sans-serif) as the last one in a font-family value has often been
criticized. In principle, generic font family names are supposed
to be mapped to _typical_ fonts in a category. But typical fonts tend to
be old fonts, and old fonts tend to have relatively small character
repertoires.
However, the CSS font model is based on the idea of determining
(at the conceptual level at least) the font for a character individually
for each character. If none of fonts declared contains a glyph for the
character, the browser is supposed to use a "use a UA-dependent default
'font-family'". Apparently, the spirit is that the browser should have a
list of fonts in reserve, though nominally it could be very short.
See "Font matching algorithm" in the Candidate Recommendation CSS 2.1
(in principle, work in progress; in practice, CSS as currently defined),
at http://www.w3.org/TR/CSS21/fonts.html#algorithm
This is how Opera and Firefox work. The problem is with Internet Explorer,
which more or less just uses the declared font-family list and picks up
the first one that is available on the system, without checking whether it
contains all the characters that appear in the text.
> P {
> COLOR: #000000; FONT-FAMILY: Arial, Geneva, sans-serif;
> BACKGROUND-COLOR: #fffffe
> }
>
> Since every Windows system has Arial, and (IIRC) every Mac has Geneva,
> no browser on either of these platforms ever gets a chance to choose a
> font with better coverage.
They can and should, but IE probably won't. And, as a matter of principle,
not every Windows system has Arial and not every Mac has Geneva. Even if a
system is shipped with some fonts, a font might be removed (intentionally
or by mistake).
The practical conclusion is that for web authoring, the font names
in a font-family list should be chosen so that each of them contains
all the characters that appear in the text of an element, without relying
on the defined fallback mechanism. This can't be exact science, since
fonts with the same exact name often exist in different versions, with
different character repertoires.
-- Jukka "Yucca" Korpela, http://www.cs.tut.fi/~jkorpela/
This archive was generated by hypermail 2.1.5 : Mon Apr 25 2005 - 23:54:40 CST