Skip to main content

Module paragraph

Module paragraph 

Expand description

Paragraph-wide line composition.

Unlike greedy wrapping, this module considers every legal line ending in a paragraph together. The cost model follows Knuth–Plass: spaces carry stretch and shrink, visually incompatible adjacent lines are discouraged, and flagged breaks (normally hyphens) acquire an additional penalty.

Structs§

ComposedLine
One chosen line, indexing a half-open range of the input boxes.
ParagraphBox
One shaped box in logical order. A box is usually a word or an unbreakable inline fragment; callers retain the actual glyph/style data separately.
ParagraphOptions
Tunable paragraph-composition policy. Defaults are deliberately close to TeX’s ordinary prose behavior while remaining expressed in font-relative space capacities supplied by the caller.

Functions§

compose_paragraph
Compose a paragraph globally. If the requested tolerance has no feasible solution, progressively looser emergency passes are tried; the final fallback preserves every box and always makes forward progress.