Re: Em's, ex's and %ages

Subject: Re: Em's, ex's and %ages
From: James Clark <jjc@xxxxxxxxxx>
Date: Sun, 20 Apr 1997 17:45:45 +0700
At 17:16 19/04/97 -0400, Paul Prescod wrote:
>I converted a CSS stylesheet to DSSSL as an educational exercise and
>to compare the difficulty. Most things are easy. One thing that is hard
>is units. CSS uses "em"s:
>H1 { margin: 0.5em }      /* ems, the height of the element's font */
>H1 { margin: 1ex }        /* x-height, ~ the height of the letter 'x' */
>The first could be calculated based on the font-size characterstic, but
>must be recalculated for each element, and so could not use the regular
>DSSSL quantity notation.

.5em is the same as (* (actual-font-size) .5)

> What about the latter? Can I get that
>information from the font-property?

You could get it via the font-property procedure, but that's a kind of
heavy-weight solution, and it's not implemented or Jade.  Indeed it's not
possible to implement it except with backends that are tightly coupled with
the formatter.  Probably the easiest solution would be an external procedure
that returns a length-spec.

> Is ISO/ IEC 9541-1 available online?


>Aren't variable-sized em's and ex's were pretty standard in the
>publishing world?

ems are much more common that exs in my experience.

>CSS users also often use sizes in terms of the containing flow object:
>e.g. width: 100% . I believe there to be no easy way to do that in
>DSSSL, even if I give up the quantity notation. Am I correct? 

No.  That's what display-size is for.

>looking for something like (parent-display-size) or a "generated"
>(delayed) version of it. Wouldn't access to context make rules more

The model for margins/indents is completely different in DSSSL than in CSS.

I believe that

margin-left: 20%

in CSS is equivalent to

start-indent: (+ (inherited-start-indent)
                 (* (- (display-size)

in DSSSL (ie the indent of this element is the indent for the parent element
plus 20% of the available horizontal space for this element).


Current Thread