Re: font-size and accents, again

David Perrell wrote:
> 
> Erik van der Poel wrote:
> > CSS2, section 10.8.1:
> >
> >   User agents center glyphs vertically in an inline box,
> adding
> >   half-leading on the top and bottom. For example, if a
> piece
> >   of text is '12pt' high and the 'line-height' value is
> '14pt',
> >   2pts of extra space should be added: 1pt above and 1pt
> below
> >   the letters.
> >
> > I assume that the intent of this paragraph was to have a
> font-size of
> > 12pt with a line-height of 14pt, but it says that the *text*
> is 12pt. Is
> > this a typo in the spec?
> 
> "12pt text" means the same thing as font-size: 12pt.

But it doesn't say "12pt text". It says "a piece of text is '12pt'
high". This sounds more like the vertical bounds of a particular piece
of text. You and I seem to be able to guess the intent, but it shouldn't
be necessary to guess. The spec should be clear.

> Whatever, section 10.8.1 certainly isn't clear about the
> vertical position of text within the inline box. If it were
> taken literally, each glyph would be centered individually.

Yes, the spec needs to be clarified.

> Is the intent is to position each text element vertically
> centered in its inline box?

I don't know what their intent was. I hope they will tell us. When a
piece of text is centered vertically, it can be centered with respect to
at least 3 distinct things:

  1. the font's em square
  2. the font's bounding box (max ascent + max descent)
  3. the text's vertical height

> How about this:
> 
> "The height of a font's character glyphs may not be the same
> as the the font's size. In dual-case fonts, for example, the
> vertical distance between the ascender (the top of the
> lowercase 'd') and the descender (the bottom of the lowercase
> 'p') is typically less than the size of the font, while the
> distance from the top of accented uppercase characters to the
> bottom of the descender may be greater than the size of the
> font.

I'd prefer not to mention specific parts of letters like the ascender
and descender. Instead, I think that font-size should be defined in
terms of the em square, and that this term should be defined somewhere
(i.e. not here).

> User agents should position text such that a horizontal
> line equidistant from the top of the ascender and the bottom
> of the descender is congruent with a horizontal line bisecting
> the inline box."

Again, I think that the vertical centering should be defined in terms of
the em square, bounding box or text height.

> But vertical centering of glyphs presents a problem if you
> want to mix typefaces on a line and still get consistent line
> spacing. Aligning inline boxes with different typefaces to
> their respective baselines will very likely result in a text
> box taller than the specified line-height.

Each inline box has its own line-height value. The height of the line
box depends on the various line-height values.

Erik

Received on Sunday, 28 November 1999 12:40:32 UTC