Skip to content

Discussion request: CSS usage in WICG's Formatted Text proposal #6629

@travisleithead

Description

@travisleithead

Hi CSS WG!

An incubation experiment (canvas formatted text) is underway in WICG in which the thesis summary is: can we leverage the power of the CSS layout engine for text line formatting outside of the DOM to provide both 1) richer text formatting options for HTML Canvas rendering and 2) detailed line metrics? The solution aspires to integrate into other existing efforts like Houdini Layout API's treatment for inline boxes). A lot more background can be found in the incubation's explainer. Note, the CSS WG discussed an early version of this proposal last July in w3c/css-houdini-drafts#990, topic: "String based inline layout API".

A primitive JavaScript data model for holding text includes a mechanism similar to DOM Nodes for supplying CSS properties/values through a StylePropertyMap.

At this point in the incubation effort, we would like to validate and discuss the chosen approach to CSS usage with the CSS WG.

Some questions we are thinking about:

  • The proposed data model isn't specifically tied to HTML canvas. It doesn't necessarily need to follow typical Canvas conventions. We like leveraging the familiar CSS properties versus introducing a parallel set of new JS APIs that do basically the same thing.
  • Only a subset of CSS would be supported (properties applicable to inline/text layout). Is there precedent for such a subset? What precedent might this be establishing for the future?
  • We assumed StylePropertyMap is the preferred entry point for modern CSS-OM/ Typed OM. Should legacy .style object access be included?

Whether CSS syntax is ultimately used as the styling input mechanism or not, the specification of line formatting behavior is expected to conform to existing CSS norms, and refer to algorithms and definitions in CSS language specifications.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions