sextile.viewdata.typesetting

Laying blocks out as frames.

Blocks are flattened into a stream of rendered rows first, then divided between frames. Doing it in that order keeps the two hard parts apart: deciding what a quotation four deep should look like, and deciding where a screen ends.

Colour carries structure. Someone reading in monochrome still follows the text; someone reading in colour can tell at a glance whose words they are looking at. A quotation is cyan, a listing green, an image or attachment magenta, and the author’s own words white.

A document long enough to exhaust a page’s frames shows a notice rather than ending mid-sentence, and TRUNCATION_NOTICE is that notice – used here and by the layout, so a reader meets the same words on a long document and on a long list.

class sextile.viewdata.typesetting.Row(text, colour, indent=0)[source]

Bases: object

One rendered row of body text, with the colour that says what it is.

Parameters:
sextile.viewdata.typesetting.TRUNCATION_NOTICE: Final = '... TRUNCATED, TOO LONG TO SHOW'

Said on the last frame of anything too long to show in full, by a document and by the layout alike: a reader who has reached the end of what there is should not have to wonder whether that was all of it.

sextile.viewdata.typesetting.rows_for(content)[source]

Render a document into rows, without dividing them between frames.

For a caller that wants to do its own pagination – a layout that has a lead-in on the first frame, say, and so cannot use a fixed frame size.

Parameters:

content (Document)

Return type:

list[Row]