Better typography with text-wrap pretty

E-readers and digital text layout

  • Some expect text-wrap: pretty to improve notoriously poor e‑reader layouts; others note that many e‑readers already have decent engines (hyphenation, hanging punctuation) and that adoption will be slow, especially from Amazon.
  • Clarification that EPUB is basically HTML+CSS; whether devices benefit depends on which engine they ship and whether vendors enable these features.

Traditional typography and TeX context

  • Several comments contrast web layout with the history of hot-metal/phototypesetting and modern tools like InDesign and TeX’s Knuth–Plass algorithm.
  • Emphasis that high-end print still relies on semi-automated algorithms plus manual fixes to avoid widows, rivers, and bad rags.

Browser support and behavior differences

  • Confusion cleared: WebKit didn’t invent text-wrap: pretty; Chromium shipped a limited version earlier.
  • Chrome optimizes mostly for short last lines and only looks at a few trailing lines.
  • WebKit claims full-paragraph evaluation, improved rag, and better behavior at scale.
  • Firefox lacks support but has a positive standards position.

Performance and algorithmic complexity

  • Long debate over whether performance cost is meaningful for typical sites.
  • Links to Chromium design docs: naive paragraph-level optimization is expensive (O(n!) in break opportunities); Chrome limits computation (e.g., last 4 lines, only when last line is very short).
  • Some argue modern CPUs make this negligible for most content; others cite real slowdowns in games, large documents, and complex Unicode/OpenType text.
  • Concern that browsers must keep such features fast enough for low-power devices and dynamic layouts.

Rivers, orphans, and possible metrics

  • WebKit’s implementation currently focuses on last-line length and rag, not river detection.
  • Discussion of how hard it is to formalize “rivers” (angles, gaps, interruptions). References to TeX tools that only detect rivers for human editing.
  • Suggestions range from whitespace-connectedness metrics to potential ML approaches, but feasibility and complexity are debated.

Standardization vs implementation freedom

  • Some dislike that the spec leaves “pretty” behavior undefined, arguing CSS should converge on consistent visual results.
  • Others defend this as reflecting typographic traditions where no single “correct” layout exists, and as a form of progressive enhancement where different engines can innovate.

Practical usage and related features

  • text-wrap: balance is already widely used for headings to avoid awkward breaks.
  • text-align: justify is noted as orthogonal (edge alignment vs. line-break optimization); they can be combined.
  • Various manual tricks (non-breaking spaces, soft hyphens, custom JS/TeX-like algorithms) may become less necessary as browser support improves.

Aesthetics, readability, and evidence

  • Many welcome any step toward nicer web typography, arguing the web regressed compared to print.
  • Some ask for empirical evidence that such wrapping improves reading speed or comprehension; no concrete studies are provided in the thread.