render_pages#
Import |
|
Defined in |
|
Install |
|
Since |
0.10 |
Stability |
Public: follows semantic versioning. Below 1.0, a minor release may change it, and the CHANGELOG says how. |
- scenet.emit.page.render_pages(pages, panels, *, live_text=False, debug=False, fonts=None, aria=True, embed=None, mono=False)[source]#
Render every page side by side, as one SVG document.
What a single view shows – the playground’s, for one. Each page sits in a group
page-<n>, and panel positions count on across pages, so every id in the document stays unique.- Parameters:
panels (
Mapping[str,PanelCore]) – Every panel’s compiled Core, by name.live_text (
bool) – Emit lettering as<text>rather than glyph outlines.debug (
bool) – Place each panel’s diagnostic overlay instead of the panel.fonts (
Mapping[str,FontMetrics] |None) – The declared fonts the panels were lettered in, by digest – whatBook.fontsholds.aria (
bool) – Make the document a named group of pages, each a named group of panels a screen reader reads in order.Falsewrites none of 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:
Every page, side by side, as SVG – left to right, or for pages read right to left, from the right, as a manga’s spread opens. They are written in reading order.
- Raises:
RenderError – There are no pages, a page places a panel
panelsdoes not hold, a Core names a font not given asfonts, a picture is to be embedded and its bytes are not inembed, or the pages are not all read the same way.
Note
The spread opens as the pages are read: from the right for pages read right to left.
Example
>>> from scenet import compile_book, render_pages >>> book = compile_book( ... "cast: {a: {reference: alice}}\n" ... "panels: {one: {}, two: {}}\n" ... "pages: [{tiers: [{panels: [one]}]}, {tiers: [{panels: [two]}]}]" ... ) >>> cores = {name: result.core for name, result in book.panels.items()} >>> render_pages(book.pages, cores, fonts=book.fonts).splitlines()[0] '<?xml version="1.0" encoding="UTF-8"?>'
See also
render_page, for one page.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.