Skip to main content

Module justification

Module justification 

Source
Expand description

Microtypographic justification controls for the Knuth-Plass pipeline.

This module provides stretch/shrink/spacing penalty configuration that modulates how the line-break optimizer distributes white space across justified text. It complements super::vertical_metrics (vertical spacing) with horizontal spacing controls.

§Design

All widths are in cell columns (terminal-native units). The stretch and shrink values define the allowable range of space adjustment per space category. The optimizer penalizes deviations from the natural width according to a cubic badness function (TeX convention).

§TeX heritage

The glue model follows TeX’s concept: each space has a natural width, a stretchability, and a shrinkability. The adjustment ratio r is computed as slack / (total_stretch or total_shrink), and badness is |r|³ × scale.

Structs§

GlueSpec
TeX-style glue specification: natural width + stretch + shrink.
JustificationControl
Unified justification configuration.
SpacePenalty
Penalty modifiers for space adjustment quality.

Enums§

JustifyMode
Text alignment mode.
SpaceCategory
Classification of horizontal space types.

Constants§

SUBCELL_SCALE
Sub-cell units per cell column.