render_strip#
Import |
|
Defined in |
|
Install |
|
Since |
0.1 |
Stability |
Public: follows semantic versioning. Below 1.0, a minor release may change it, and the CHANGELOG says how. |
- scenet.emit.strip.render_strip(panels, *, live_text=False, debug=False, fonts=None, aria=True, embed=None, mono=False)[source]#
Lay panels side by side in reading order: left to right, or right to left.
Each panel is rendered independently and then placed, rather than being re-solved: a panel’s composition must not depend on what sits beside it, or the same source would compile differently in isolation. Panels read right to left are laid from the right; they are still written in reading order, which is the order a screen reader follows.
- Parameters:
panels (
list[tuple[str,PanelCore]]) – Panel name and compiled core, in reading order.live_text (
bool) – Emit lettering as<text>rather than glyph outlines.debug (
bool) – Place each panel’s diagnostic overlay instead of the panel itself, in exactly the same positions, so a sequence can be debugged as a sequence.live_textdoes not apply: the overlay labels in plain text already.fonts (
Mapping[str,FontMetrics] |None) – The declared fonts the panels were lettered in, by digest – whatBook.fontsholds.aria (
bool) – Make the strip a named group of panels, each one image a screen reader reads whole, in reading order; its background hidden.Falsewrites none of it. An overlay is a diagnostic, and never has it.embed (
Mapping[str,bytes] |None) – The supplied pictures’ bytes, by digest – whatBook.imagesholds – to write into the SVG. Left out, each picture is linked by the path its document wrote.mono (
bool) – Draw every value as its grey and ignore its colour, as for a black-and-white edition. Every decision was made on the grey, so this draws exactly whatpalette: monowould; seePanelCore.as_mono.
- Return type:
- Returns:
One SVG document holding every panel.
- Raises:
RenderError – There are no panels, or they are not all read the same way.
Note
Panels are scaled to one height and set side by side in the order given – from the right when they are read right to left. A strip is not a page: it has no trim.
Example
>>> from scenet import compile_scene, render_strip >>> panels = compile_scene("cast: {a: {reference: alice}}\npanels: {one: {}, two: {}}") >>> strip = render_strip([(name, result.core) for name, result in panels.items()]) >>> strip.splitlines()[0] '<?xml version="1.0" encoding="UTF-8"?>'
See also
render_pages, for panels laid out on pages.Added in version 0.7: The
debugparameter.Added in version 0.11: The
fontsparameter.Added in version 0.12: The
ariaparameter.Added in version 0.12: The
embedparameter.Added in version 0.13: The
monoparameter.