Re: [csswg-drafts] [css-inline] baseline synthesis: add ideographic embox and baseline offset

Thank you Nat for opening this discussion. I'm in favor, and I'm leaning to define it precisely to make it interoperable. The needs for an interoperable font metrics has been around, such as:

* The `CanvasTextDrawingStyles` has [`textBaseline`](https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-textbaseline), whose `top`, `middle`, and `bottom` refers to _em square_, but this _em square_ is not defined anywhere. This caused Canvas interoperability problem in whatwg/html#2470. @annevk suggested that we define _em square_ somewhere for other specs to refer to.
* Blink needed heuristics and try-and-errors to determine good rendering for ruby, emphasis marks, etc.
* The [Font Metrics API](https://drafts.css-houdini.org/font-metrics-api/) would like to provide an interoperable metrics. Currently it has [`emHeightAscent`](https://drafts.css-houdini.org/font-metrics-api/#dom-fontmetrics-emheightascent) and [`emHeightDescent`](https://drafts.css-houdini.org/font-metrics-api/#dom-fontmetrics-emheightdescent), using _em square_.

I briefly talked about the needs of interoeprable font metrics with @litherum and @boggydigital before, they seem to be interested in the discussion. I think we will need more metrics to be defined as we move on, because em box is probably not very useful for taller scripts such as Arabic, but it is still a good start.

In whatwg/html#2470, @jfkthame suggested that Gecko's _em square_ is to use `sTypoAscender` and `sTypoDescender` normalized by `UnitsPerEm`, so that their sum should be 1em exactly.

I tried using this logic in Blink and it was quite successful at least for Latin and East Asian. This is also very similar to the [OpenType Ideographic Em-Box](https://www.microsoft.com/typography/otspec/baselinetags.htm#ideoembox) fallback logic for CJK font.

Nat, does this definition look reasonable to you?

/cc @eaenet @FremyCompany @dbaron 

-- 
GitHub Notification of comment by kojiishi
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/1961#issuecomment-343153671 using your GitHub account

Received on Thursday, 9 November 2017 13:26:34 UTC