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

Open
#6,629 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
20/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
css
Domain
web-dev

Research direction

Start with this issue, then read the linked WICG canvas-formatted-text explainer and explainer-datamodel.md, especially the supported CSS section. Review the earlier CSS Houdini issue and its discussion for context. Done would require a resolved CSS WG position on the proposed CSS usage, but the issue does not define a concrete implementation task.

Written by the indexing model from the issue text.

Description

css-text-4

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 https://github.com/w3c/css-houdini-drafts/issues/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!

Dominant language
Bikeshed
Stars
4.9k
Forks
816
Avg merge
2d 18h
Merged PRs (30d)
24

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from w3c/csswg-drafts

All issues in w3c/csswg-drafts

Similar issues

More Web Dev issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.