[csswg-drafts] [css-inline-3] Define em-top and em-bottom baselines (#5312)

fantasai has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-inline-3] Define em-top and em-bottom baselines ==
The Canvas API has several references into the metrics defined in 

It also defines emHeightAscent and emHeightDescent but doesn't have a concrete definition for them. Talked with @jfkthame about what they might be defined as and currently thinking maybe we add in definitions for these for HTML to [refer into](https://github.com/w3c/csswg-drafts/issues/5266), so all the related metrics are all defined in [one place](https://drafts.csswg.org/css-inline-3/#baseline-types) (even if CSS doesn't end up using this particular pair).

Proposed definition from me and @jfkthame is:
* if the ideographic-top + ideographic-bottom or ideographic-central baselines are defined by the font, emHeightAscent is 0.5em above the ideographic-central and emHeightDescent is 0.5em below. (This will normally make ideographic-top = emHeightAscent and ideographic-bottom = emHeightDescent, but if ideographic-top and ideographic-bottom are not 1em apart it will normalize the distance to 1em)
* if none of the ideographic baselines are defined, use the ascent and descent normalized proportionally so they add up to 1em

Roughly in code, something like:
```
if iTop | iBottom | iCentral:
  /* rules of font format considers at least one of these defined */
  if iBottom && !iTop:
    iTop = iBottom + 1em;
  if iTop && !iBottom:
    iBottom = iTop - 1em;
  if !iCentral:
    iCentral = (iTop + iBottom)/2;

  return (iCentral + 0.5em, iCentral - 0.5em);
else:
  p = 1em/(ascent - descent);
  return (ascent*p, descent*p);
```

CC @annevk @yiyix

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5312 using your GitHub account

Received on Thursday, 9 July 2020 22:42:56 UTC