- From: Ian Kilpatrick via GitHub <sysbot+gh@w3.org>
- Date: Wed, 08 Jul 2020 03:58:00 +0000
- To: public-houdini-archive@w3.org
This sounds like a pretty good fit for the current API that we have exposed. E.g. you could imaging something like:
```js
const node = new LayoutChild('lots of text');
const f1 = node.generateNextFragment({availableInlineSize: 10});
const f2 = node.generateNextFragment({availableInlineSize: 30}, f1.breakToken);
canvasCtx.fill(f1);
canvasCtx.fill(f2);
```
There is a few open questions about some requirements:
- When should be exposed in terms of position of glyphs? E.g. presumably some web pages would want to show a caret or similar to "editing" text in a canvas.
- (Any other information needed?)
- How to style runs inside the next, e.g. if a something needed a bold style or similar (canvas obviously provides a way for color, and paint related styles, but would need something for other text features.
E.g. you could imagine an API like:
```js
const node = new LayoutChild('lots of text', [
{startIndex: 5, endIndex: 10, fontWeight: 900},
{startIndex: 8, endIndex: 12, fontStyle: 'italic'},
]);
```
cc/ @kojiishi @fserb
--
GitHub Notification of comment by bfgeek
Please view or discuss this issue at https://github.com/w3c/css-houdini-drafts/issues/990#issuecomment-655268084 using your GitHub account
Received on Wednesday, 8 July 2020 03:58:01 UTC