Path: news.fas.harvard.edu!dbaron From: dbaron@is02.fas.harvard.edu (David Baron) Newsgroups: comp.infosystems.www.authoring.stylesheets Subject: Re: "em" Date: 9 Oct 1999 20:53:27 GMT Organization: Harvard University, Cambridge, Massachusetts Lines: 52 Message-ID: References: <37fe164c$0$205@nntp1.ba.best.com> <37FF7B42.667F16D2@ix.netcom.com> Reply-To: dbaron@fas.harvard.edu NNTP-Posting-Host: is02.fas.harvard.edu X-Newsreader: slrn (0.9.5.2 UNIX) Xref: news.fas.harvard.edu comp.infosystems.www.authoring.stylesheets:14670 In article <37FF7B42.667F16D2@ix.netcom.com>, Joel Shepherd wrote: > Todd Fahrner wrote: > > Frances Del Rio wrote: > > > What does "em" mean, as in "{word-spacing: 0.4em}"? > > > > In CSS, em is a length unit equivalent to the font-size of the > > parent element. > > Not trying to be pedantic, but how is 'font-size' defined? If > font-size is 14pt, what does this mean? (I assume it's a measure of > height, not width.) CSS2 says that the font size is the "size of the font when set solid" [1]. Set solid means (as I understand it) that there should be room for any character within the height, but nothing else, as described in [2]. So it means that all of the characters in the font (including descenders and diacritical marks) should fit within the font-height. However, this is not the way most Postscript and TrueType fonts are defined. They generally "stick out" of their font-size boxes [3]. Since browsers get font glyphs from the operating system, they usually just ask for the font-size they want, and then the operating system gives them something that, according to CSS, is too big. Browsers differ significantly in how they handle that problem. I've described some of the differences in [4]. >From what I've heard, font metrics contained within common fonts (and perhaps more so for less common fonts) are very often incorrect. This makes it difficult or impossible to properly implement things like 'ex' units and the 'font-size-adjust' property. It also makes me think correction of this problem (by better conformance to CSS) is unlikely. I proposed [5] that CSS should (somehow) define exactly how this problem should be handled so that things based font sizes (in particular, line-height) are displayed consistently across browsers. The difference is significant: line heights can appear different by a factor of 1.2 (or more, for some fonts), and other problems can also result. David [1] http://www.w3.org/TR/REC-CSS2/fonts.html#font-size-props [2] http://css.nu/articles/typograph1-en.html#Ch22 [3] http://www.fas.harvard.edu/~dbaron/css/fonts/aspect_results [4] http://www.fas.harvard.edu/~dbaron/css/fonts/sizes/ [5] http://lists.w3.org/Archives/Public/www-style/1999May/0026.html -- L. David Baron Sophomore, Harvard (Physics) dbaron@fas.harvard.edu Links, SatPix, CSS, etc. WSP CSS AC