W3C home > Mailing lists > Public > www-style@w3.org > July 1997

Re: font sizes in ems

From: David Perrell <davidp@earthlink.net>
Date: Thu, 17 Jul 1997 15:12:15 -0700
Message-Id: <199707172213.PAA22596@germany.it.earthlink.net>
To: "Gayle Kidder" <reddik@sandiego.com>, <www-style@w3.org>
Gayle Kidder wrote:
> ...An em (which is inadequately
> defined in CSS1) is, as best I can understand, the total size of the
> font, measured more or less from the bottom of the descenders to the
top
> of the ascenders, or roughly the width of a capital M in the font.
> (Historically this gets very complicated, but let's start from
there.)

Please, don't get historical. For most of my graphical career, there
were approximately 72.46 points per inch, not the nice round 72
commonly used today. All my Haberule type gauges and printer's
comparative scales reflect that. And yet, for as long as I've been
around, an em has been the square of a type font. What this means is
that whatever the type size, that is also the size of an em for that
font. 12pt type? 1em = 12pt. 30px type? 1em = 30px. etc. etc.
 
> If I specify a font size of 1em, then, it comes out considerably
larger
> than the default body type size of the user. I've experimented with
> several different default fonts and sizes and find that in order to
> approximate the user's default size you need to specify something
> between .6 and .8 em, with .8em being the most reliable conversion
among
> those I tested.

If so, this is just plain wrong on the part of the browsers. If the
BODY font size on the reader's stylesheet is 12pt Times Roman, setting
the type-size to 1em without any other changes should have no effect at
all.

> This, of course, varies with the font...

It should vary with font-family, because the size of the letters are
not directly related to type size. The type size simply determines how
much vertical space is to be allotted, it says nothing about how much
of that space is filled with a character. Look at some fancy scripts
with very high acenders and descenders and tiny x-height. You need a 20
type size to look as big as a 10pt Helvetica. And there are some really
weird fonts where the vertical dimensions of the characters exceed the
type size -- without leading, ascenders and descenders can overlap.
(such fonts would not have been possible before phototypesetting)

> Therefore, I can't see how one can advocate starting with an em as
the
> recommended unit for an initial font spec, since users' default fonts
> are liable to vary considerably. Or can one recommend a standard
> conversion value for an em to user's default, say .8?

The fact that user's default font sizes will vary is the reason for the
advocacy.

> Another typographer friend of mine has this to say:
>  "[Designating font sizes in ems] is literally nonsensical in
> traditional terms.  An em is a unit of space; 12pt is a unit of size
..
> it is meaningful to say "a 12-pt em" or "a 12-pt font" but not a
"1-em
> font" -- the size of the em varies according the size of the font,
not
> vice versa."

Of course it's nonsensical in traditional terms because in traditional
terms a point is approx. 1/72 inch and when you print a point to paper,
that's what it is. But on the reader's display, an author has no idea
what a point is going to be. On the Macintosh, a point is a pixel. On a
high-res display that may be 50% of actual size. Initially, I advocated
points as preferable to pixels, but I've come to see point measures
can't be practical unless users are able to adjust the point to pixel
mapping of their displays.

> Yet I seem to see designating font sizes in ems being advocated in
this
> group. Do I misunderstand? Any clarification gladly solicited.

The meaning of em has been discussed in this forum many times. 1em
equals 100% of the font size.

I just tested NSN 4.01 on Windows95. Netscape almost has it right, BODY
spec'd as 1em is exactly the same size as my default font size, EXCEPT,
for some strange reason, for the Verdana. (I have not yet installed
MSIE 4.0B2.)

Your test page is meaningless. You are comparing a reader-font-relative
size of 1em to an absolute size of 10pt. To make your test valid, add
this to the declaration:

          BODY { font-size: 10pt }

Now, all of your em measurements should refer to the 10pt BODY (the
parent of P), and so 1em should equal 10pt for each of the fonts.

As to why you're getting a different relationship in MSIE and NSN -- is
the default font size exactly the same in both browsers? Remember,
since you did not explicitly set a size on BODY, your em measurements
are relative to the _default_ font size of the browser. That's the
whole point!

All you need to remember is that

(1) 1em = 100% of the font size.

(2) you have no way of knowing the point or pixel size of a client's
default font, therefore em or percent are the best way to give a reader
a font size relative to what she/he is accustomed to reading. 

David Perrell
Received on Thursday, 17 July 1997 18:13:43 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:53:50 GMT