Re: ex

Matthew Brealey wrote:
> 
> Erik van der Poel wrote:
> >
> > The spec gives the following example for "ex":
> >
> >   H1 { margin: 1ex }
> >
> > If the font-family property contains multiple fonts, which font is used
> > to determine the length of 1ex?
>
> The one that is actually used for the H1 element; e.g., H1 {font-family:
> notavailable, notavailable, sans-serif} uses the x-height of the
> sans-serif font that is selected by the ua

No, the fonts in the font-family list are tried, in order, not only to
find a font that is available, but also to find a font that contains a
glyph for the current character(s).

For example, let's suppose you have Arial and MS Gothic (Japanese) on
your system. Suppose the font-family says this:

  font-family: Arial, "MS Gothic";

If there is a Japanese character in the document, the implementation
will not find a glyph for it in Arial, so it must go to the next font
(MS Gothic), where it *will* find an appropriate glyph.

Even in your example (not-avail, not-avail, sans-serif) the
implementation will process a list of fonts, because sans-serif can be
defined in terms of multiple fonts. There are examples of this in the
spec:

  http://www.w3.org/TR/REC-CSS2/fonts.html#q47

The serif example shows a list of fonts in the src descriptor (which I'm
not sure are supposed to be processed in the same way as font-family
lists), and the Excelsior example shows the use of the unicode-range
descriptor to multiplex a group of fonts. I'm assuming that you can use
unicode-range in this way with the generics (serif, sans-serif, etc)
too.

Even if there is no generic font in the font-family list, the spec says
that the implementation can use the inherited or UA-dependent
font-family value as a fallback. The UA-dependent value could contain a
generic font, of course.

So, my question still stands: Which physical font(s) must the
implementation look at to determine the real value of "ex"? I would like
to propose the following spec:

  The implementation SHOULD use the first available font in
  the font-family list to determine the x-height that forms
  the basis for the ex unit. If none of the fonts in the
  font-family property are available, the implementation
  MAY use the inherited or a UA-dependent font-family value
  for further searching.

Erik

Received on Wednesday, 19 January 2000 12:33:33 UTC