Canvas text writing mode support
- Category
- Graphics
- Type
- New or changed feature
- Status
- Proposed (Chrome Proposed)
- Intent stage
- None
Summary
Writing mode support for HTML canvas text will enable correct text shaping for vertical text, as already supported by CSS. Canvas text styles gain a "writingMode" attribute along with a "textOrientation" attribute that have the same effect on a text run as the related CSS properties. The various alignment attributes are augmented to support vertically oriented text. The CSS properties from the canvas element style are ignored.
Motivation
Canvas text styles do not provide any direct control over the writing mode and character orientation, and browsers are inconsistent with how they treat the CSS properties on the canvas element. The workaround is to render and position each character separately, which may require a JS implementation of text shaping.
Standards & signals
- Firefox: No signal
- Safari: No signal
- Web developers: Positive
- Tracking bug: https://issues.chromium.org/issues/467169720
Ecosystem
- Web Platform Tests: https://wpt.fyi/results/?q=canvas-text-writing-mode-support
- Chrome Platform Showcase: https://chrome-platform-showcase.paulkinlan-ea.deno.net/features
- GenDN reference: https://gendn.paulkinlan-ea.deno.net/features
- chrome.dev demos search: https://www.google.com/search?q=site%3Achrome.dev+Canvas%20text%20writing%20mode%20support
- MDN Web Docs: https://developer.mozilla.org/en-US/search?q=Canvas%20text%20writing%20mode%20support
- Baseline status: https://webstatus.dev/?q=Canvas%20text%20writing%20mode%20support
Explainers: https://github.com/schenney-chromium/explainers/blob/canvas-writing-mode/canvas-writing-mode/README.md