Skip to content

[css-text-4] Allow for paragraph-level line breaking #672

Closed
@litherum

Description

@litherum

There are a few algorithms which attempt to choose line breaks within a paragraph in order to maximize the beauty of the paragraph as a whole. Such algorithms try to do some subset of:

  • Minimize hyphenation
  • Minimize extra space at the end of each line (or between words for justified text)
  • Minimize rivers
  • Minimize widows/orphans
  • Minimize two hyphenated lines in a row
  • Minimize visual differences between adjacent lines
  • Minimize single-syllable or single-word last lines
  • For paginated media, minimize single lines at the beginning or end of pages
  • More?

Obviously, it is impossible to satisfy all these desires simultaneously for arbitrary paragraphs. The exact algorithm should not be specced for these reasons:

  • Browsers should be allowed to innovate with heuristics of deciding how hard to try to solve one item at the expense of the other items
  • Browsers should be allowed to teach and improve their implementations about new typographical conventions as time goes by
  • Criteria for beautiful paragraphs are locale- and language-specific
  • Different user agents may wish to provide different thresholds of participation (e.g. only consider a sliding window of n lines, or bail after x milliseconds of compute time, etc.)

Instead, there should be a way for a web author to opt-in to paragraph-level layout for beautiful paragraphs.

I'm not sure what the best mechanism for this is. Perhaps a new value to the text-wrap property? Perhaps a new property? Perhaps something else?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions