Expand description
Layout: box construction, inline layout, fragmentation.
content + style ─► box tree ─► line layout ─► fragmentation ─► pagesv0.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, float keeps the room
a floated image takes in its column, 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.
- Floated
- An image floated to one side of its column. The fragment’s
xis the leading edge of its margin box and its height is the height of that box, which is what the prose beside it keeps clear of. - 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 ofDrawItems out. - Reflow
- A paragraph the flow can set again.
- Table
Row - 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§
- Break
Point - 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.