Re: font-size and line-height

Jan Roland Eriksson wrote:
> 
> On a few occasions the text of the CSS1 spec gives better explanation of
> things. From the CSS1 section on "Terminology"
> 
>   font size
>     The size for which a font is designed. Typically, the size
>     of a font is approximately equal to the distance from the bottom
>     of the lowest letter with a descender to the top of the tallest
>     letter with an ascender and (optionally) with a diacritical mark.

This definition seems a little vague to me. It uses words like
"typically" (i.e. not always), "approximately" (i.e. not exactly), and
"optionally" (does the implementor get to choose whether or not to
include diacritical marks?).

> Some illustrations here might be of interest...
>   http://css.nu/articles/typograph1-en.html
> ...to clarify the meaning of this?

Thanks for the pointer.

The reason I'm asking about this is because I'm trying to implement CSS
on X Windows, and it has the following definitions:

# 8.2.1.  FONT_ASCENT
# 
# FONT_ASCENT is an integer value (of type INT32) that  gives  the 
recom-
# mended  typographic  ascent above the baseline for determining
interline
# spacing.  Specific glyphs of the font may extend beyond  this.   If 
the
# current  position  point  for line n is at [X,Y], then the origin of
the
# next line m = n + 1 (allowing for a possible font change)  is  [X,  Y 
+
# FONT_DESCENTn + FONT_ASCENTm].
# 
# FONT_ASCENT  can  be  approximated  if  not provided as a font
property,
# according to the following algorithm:
# 
#      if (FONT_ASCENT undefined) then
#         FONT_ASCENT = maximum ascent
# 
# where maximum ascent is the maximum ascent (above the baseline) in 
pix-
# els of any glyph in the font.
# 
# 8.2.2.  FONT_DESCENT
# 
# FONT_DESCENT  is  an integer value (of type INT32) that gives the
recom-
# mended typographic descent below the baseline for determining 
interline
# spacing.   Specific  glyphs  of the font may extend beyond this.  If
the
# current position point for line n is at [X,Y], then the  origin  of 
the
# next  line  m  =  n+1  (allowing  for a possible font change) is [X, Y
+
# FONT_DESCENTn + FONT_ASCENTm].
# 
# The logical extent of the font is  inclusive  between  the 
Y-coordinate
# values: Y - FONT_ASCENT and Y + FONT_DESCENT + 1.
# 
# FONT_DESCENT  can  be  approximated  if not provided as a font
property,
# according to the following algorithm:
#
#      if (FONT_DESCENT undefined) then
#         FONT_DESCENT = maximum descent
#
# where maximum descent is the maximum descent  (below  the  baseline) 
in
# pixels of any glyph in the font.

These definitions would seem to suggest that FONT_ASCENT + FONT_DESCENT
includes the leading (i.e. in CSS terms, line-height - font-size).
However, the X document (XLFD) does say that specific glyphs may extend
beyond those boundaries.

This is what confused me. Anyway, if nobody has further advice, I will
just take CSS font-size to be X's max ascent + max descent.

Erik

Received on Sunday, 21 March 1999 14:24:24 UTC