Skip to main content

Module layout

Module layout 

Source
Expand description

Printed pages from the document’s template: a cover, the parts list, the tools list, then the steps at 1, 2 or 4 per page, portrait or landscape.

Everything is in paper millimetres from the page’s top-left corner. The layout only says WHERE each thing goes; the renderer draws the step’s view into a slot’s picture and its text into text.

A step’s Record block (crate::record: its fields as a paper form, a serial line per serial-tracked unit, the sign-off lines) goes under the step’s text. Its height is known here, measured through a TextMeasure, so the paging accounts for it: a step with a block may take more of a tall cell from its picture (down to PICTURE_MIN_SHARE of the cell and PICTURE_MIN_MM), and what still does not fit continues on Record pages right after the steps page, never over the picture and never cut off. A document whose steps record nothing and need no sign-off lays out exactly as before.

Structs§

Estimate
A measure for a caller without font metrics (a page count on a server, a test): every character half an em wide, the em 1.39 cap heights. Close to a sans-serif’s average; a renderer passes its own.
Page
RecordRow
One band of a step’s Record block, placed: the item it belongs to, which of the item’s bands it is, and where it goes. The renderer draws record::bands of the item at rect.w and takes band band.
Rect
Slot
One step’s place on a page.

Enums§

PageKind
TextLine
One line of a step’s text column.

Constants§

BODY_MM
Body text’s cap height, in millimetres.
GUTTER_MM
HEADER_MM
The band at the top of every page: document title and page number.
HEADING_MM
A heading’s cap height.
LEADING
Line pitch over cap height.
MARGIN_MM
PAPER_SIZES
Paper sizes in millimetres, landscape (the same keys and sizes as drawing sheets; portrait swaps them).
PARTS_ROW_MM
PICTURE_MIN_MM
PICTURE_MIN_SHARE
What the picture of a step with a Record block keeps when the text area grows into it: this share of the cell’s height, and never less than PICTURE_MIN_MM (a picture smaller than that says little).
RECORD_COLUMN_MM
The widest a Record page’s column is: a line longer than this is hard to write along.
TEXT_INSET_MM
The inset of a step’s text inside its text area.
TEXT_SHARE
The share of a tall cell the text area takes.
TOOLS_ROW_MM

Traits§

TextMeasure
How wide a run of text is on paper: the renderer’s font metrics, so the layout and the drawing agree.

Functions§

pages
The block’s pages, in print order, measured with Estimate: for a caller without font metrics. A renderer calls pages_with with its own measure, so its pages are the ones it draws.
pages_with
The block’s pages, in print order, text measured by m.
paper_mm
A paper key’s millimetres in orientation.
step_text
What a step’s text area says, top to bottom, wrapped to width: its number and title, the parts it adds, its tools and torque, its callouts and its notes.
step_text_height
The height of step_text: trailing space not counted.
wrap
text broken into lines no wider than width at cap height cap, at spaces; a word wider than the line stands alone on one.