WICG / canvas-formatted-text

Other
80 stars 17 forks source link

[IDEA] Support late-binding styles #44

Open travisleithead opened 2 years ago

travisleithead commented 2 years ago

As currently envisioned, the API operates on styles and text completely independently of any other context. As a common use case is to render the FormattedText to a canvas, and because the canvas context will have some drawing state already configured (in the form of the font, strokeStyle, etc.) it might be useful to "defer" some style values to whatever is configured on the current canvas. Such values would be specified as "placeholders" and then late-bound to actual canvas state at the time of rendering.

Possible scenarios:

Note there's a small subset of things that wouldn't impact layout of the content, and these would need to be clearly documented.