render_page#
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_page(page, panels, *, live_text=False, debug=False, fonts=None, aria=True, embed=None, mono=False)[source]#
Render one page as a standalone SVG document.
- Parameters:
page (
PageCore) – The page: its size and where each panel’s frame is.panels (
Mapping[str,PanelCore]) – Every panel’s compiled Core, by name. Each one named by a frame must be here, compiled at that frame’s size.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 page a named group of panels a screen reader reads in order.Falsewrites none of it. An overlay 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:
The page, as SVG.
- Raises:
RenderError – A page places a panel
panelsdoes not hold, a Core names a font not given asfonts, or a picture is to be embedded and its bytes are not inembed.
Note
A page is drawn at its own size, in page units; each panel at its frame. Nothing is laid out here: the frames are the Page Core’s.
Example
>>> from scenet import compile_book, render_page >>> book = compile_book( ... "cast: {a: {reference: alice}}\n" ... "pages: [{tiers: [{panels: [one]}]}]\npanels: {one: {}}" ... ) >>> cores = {name: result.core for name, result in book.panels.items()} >>> 'viewBox="0 0 2000 3000"' in render_page(book.pages[0], cores) True
See also
render_pages, for every page side by side.render_pdf, for print.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.