Re: Confusion over meaning of font-size

"L. David Baron" wrote:
> 
> The CSS definition of font-size is different from the one used by many
> operating systems and/or font formats.  I'm not sure exactly where the
> problem lies.  

It probably lies in insufficient integration of the later, and much
better specified, WebFonts work into some of the older, CSS1
descriptions which, as you note, could be extrordinarily vague on
occasion.

> However, a number of other things in CSS depend on font
> sizes (em units, backgrounds of inline elements, line-height), and
> different browsers compensate for the two different definitions of font
> size in different ways, causing rather serious incompatibilities. 

Right. In most cases, though, they are clearly not following the spec.

>  In
> the current situation, implementation of font-size-adjust would be
> meaningless because different browsers would probably define x-height
> in different ways.

x-height is defined in the CSS2 spec.
  http://www.w3.org/TR/REC-CSS2/fonts.html#xht

see also
  http://www.w3.org/TR/REC-CSS2/fonts.html#cap

> I've written a test showing these problems and an explanation of how
> various browsers handle the problems, at:
> 
> http://www.fas.harvard.edu/~dbaron/css/fonts/sizes/
> 
> I think this inconsistency needs to be addressed in some way so that
> presentational suggestions that are reasonable on one browser are not
> ridiculous on another. 

I agree

>  I don't really have any thoughts on how to
> solve this without the serious backwards-compatibility problems that
> would be caused by going to the spec's definition, but I hope others
> here do.

The em-square, Maximum unaccented height and Maximum unaccented depth
are defined in CSS2:

http://www.w3.org/TR/REC-CSS2/fonts.html#emsq
http://www.w3.org/TR/REC-CSS2/fonts.html#ascent
http://www.w3.org/TR/REC-CSS2/fonts.html#descent

Adding the Maximum unaccented height and Maximum unaccented depth, and
dividing by the number of units on the em-square, should give something
closer to the "operating system values" that you refer to (different OSs
have different ways of calculating this, of course; see the OpenType
spec for discussion on this, in particular the Windows ascent, the macOS
ascent, and the prefereable and more platform-neutral maximum unaccented
height.

--
Chris

Received on Tuesday, 18 May 1999 17:01:12 UTC