Skip to main content

Module layout

Module layout 

Source
Expand description

Layout: box construction, inline layout, fragmentation.

content + style ─► box tree ─► line layout ─► fragmentation ─► pages

v0.2 folds the middle of the pipeline into one pass: each section becomes fragments (each block with the style the tree computed for it, via lines::LineLayout), and the paginator flows those fragments into page content boxes. Nothing here decides what anything looks like — the style tree was told, and this asks it.

A fragment is what the flow can move: one line, one image, one ornament. Where a page may end is decided when the fragments are built — orphans, widows, break-inside, an ornament that must keep the prose around it — and the flow only stacks and, when something does not fit, walks back to the last place a break was allowed.

The stages have a file each: fragment is what the flow moves, build turns blocks into fragments, cap sets the initial letter beside them, list sets a list an item at a time with the marker of each, table sets a table a row at a time, flow stacks fragments into pages, exclusion places the images and blocks the sheet anchored and wraps prose around them, background puts art behind a box, inline paints the box an inline element takes on a line, furniture paints the margin boxes, and text turns a shaped line into paint ops.

Structs§

Decoration
One block: what it paints, and where it sits around the fragments it spans.
Decorations
What one fragment does to the blocks decorated around it.
DropCap
An initial letter sunk beside the lines that follow it.
Fragment
One thing the flow can place: a line, an image, an ornament.
Marker
The marker of a list item, set to the left of the item on the baseline of its first line.
Marks
What a fragment tells the page it lands on: the running strings its element set, and the folio its page restarts at.
Note
One note the flow sets at the foot of a page: what it is numbered, and its body as fragments of the footnote area.
Paginator
The pagination pass: content in, Pages of DrawItems out.
Reflow
A paragraph the flow can set again.
TableRow
One row of a table, set whole: what it paints, and what the flow needs to set the table’s header rows again on a new page.

Enums§

BreakPoint
Whether a page may end above a fragment.
Piece
What one fragment paints.

Functions§

layout_book
One book through the whole pipeline: lines laid out, flowed into pages, everything the output needs assembled.
margin_band
The band one margin box’s line sits in: (top, height) in page coordinates, one line tall, centred in the margin it lives in.