[css-houdini-drafts] [font-metrics-api] Compatibility notes with Canvas TextMetrics API

fserb has just created a new issue for https://github.com/w3c/css-houdini-drafts:

== [font-metrics-api] Compatibility notes with Canvas TextMetrics API ==
Following up with some questions from: https://github.com/w3c/css-houdini-drafts/issues/828

It seems that a Houdini TextMetrics API has to figure out proper use cases to track. Meanwhile, we'd like to move forward on WHATWG over the Canvas update of the TextMetrics API. And I'd really appreciate some input from folks here about some logical issues with a Canvas TextMetrics API.

The use cases for canvas are mostly caret position and character highlight.

1. But I've been told that it's not possible to assign a 1:1 map between characters and caret position (due to bidi, in which case sometimes 2 different caret position can point to the same character). If that's so, would it still be possible to properly define a 1:1 map with: if LTR, the left-most caret position associated with this character? Would that stop being useful?

2. If we want to assign, for a grapheme cluster a left-right bounding box (to be able to draw a background on a single character). It seems to me that it's always possible to map, for each character, a left-side (not start) position and an advance. This seems to be true to me even in bidi.

For Canvas, there's very little layout requirements (no vertical text, no multi-line for example). So we could think of it as a very simplified API, as long as it's not egregiously wrong from a layout perspective. Would something like this be possible?


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

Received on Wednesday, 7 November 2018 15:52:11 UTC