Contact
emails
sush...@microsoft.com, tra...@microsoft.com
Explainer
None
Summary
Easily render multiline formatted text in Canvas, while letting the browser handle the hard parts of line-breaking and other language-specific constraints.
Blink
component
Blink>Canvas
Motivation
You have a paragraph of text. You want to write it to the canvas. Canvas only supplies fill/strokeText -- only line of text at a time. Where do you break your paragraph up? Doing this is JavaScript is hard and error prone. For example, the author must consider: where are the break opportunities between words or Graphemes? Break opportunities are based primarily on the Unicode Spec but also use dictionaries for languages like Thai and French that dictate additional line breaking rules. Other consideration include identifying grapheme clusters, handling Bidi text, proper text shaping and kerning.
Luckily, the browser already has a powerful line breaking, text shaping component used for regular HTML layout. This feature enables authors to tap into the browser's layout feature while maintaining control over the layout of multi-line formatted text.
Initial public proposal
TAG review
None
TAG review status
Pending
Risks
This feature exposes new functionality to the Canvas. Similar behavior is being exposed to the CSS Houdini Layout API. Our goal is to find a good balance in terms of design that harmonizes the two concepts.
Interoperability and Compatibility
None
Gecko:
No signal
WebKit:
No signal
Web
developers:
No signals
Is this feature fully tested by web-platform-tests?
No
Tracking bug
Link to entry on the Chrome Platform Status
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/DM6PR00MB060336F0695308E30C6499C8FDCD9%40DM6PR00MB0603.namprd00.prod.outlook.com.
It does indeed sound like a good idea to leverage the browser's advanced line wrapping capabilities!
One friendly recommendation, don't wait too long with filing tag reviews and getting platform tests together, because I think this is something where there might be some discussions before everyone agrees on the best API surface.
/Daniel
I am proposing an enhancement of Intl.Segmenter API (adding line break support) to TC39 for ECMA402 (see https://github.com/tc39-transfer/proposal-intl-segmenter-v2 ) The API expose "line break opportunity" of text which implement the
Unicode® Standard Annex #14 UNICODE LINE BREAKING ALGORITHM (see https://www.unicode.org/reports/tr14/)
so it can be used for developer to use it with
During the stage advancement discussion, one delegate suggest me to reach out to Houdini to see which one of the following is better
Please comment so we can move forward better in TC39 / ECMA402. Thanks
Similar question to you- do you think the enhancement to Intl.Segmenter will be conflict or redundant to your API? or will it complement the API you intend to implement?
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/BYAPR00MB059824555DAD1801B8F6933AFDC79%40BYAPR00MB0598.namprd00.prod.outlook.com.
According to
https://issues.chromium.org/u/2/issues/40160099#comment20 - it is
not being pursued.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/92387448-12d8-43b7-baef-a8e97f032e2bn%40chromium.org.
According to https://issues.chromium.org/u/2/issues/40160099#comment20 - it is not being pursued.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/4fc7b100-d613-43d3-b64d-8d29f912973f%40chromium.org.