toyplot.text module¶
Functions for manipulating text.
-
class
toyplot.text.
Layout
(style)[source]¶ Bases:
object
Top-level container for one-or-more lines of text.
-
class
toyplot.text.
MarkerBox
(marker, style)[source]¶ Bases:
object
Container for a Toyplot marker specification.
-
class
toyplot.text.
PushHyperlink
(href, target, style)[source]¶ Bases:
object
Marks the beginning of a hyperlink.
-
class
toyplot.text.
TextBox
(text, style)[source]¶ Bases:
object
Container for a block of text that shares a single style.
-
toyplot.text.
dump
(box, stream=None, level=0, indent=' ', recursive=True)[source]¶ Writes formatted text layout information to a stream.
Parameters: - box (
toyplot.text.Layout
,toyplot.text.LineBox
,toyplot.text.TextBox
,toyplot.text.MarkerBox
,toyplot.text.PushHyperlink
, ortoyplot.text.PopHyperlink
, required) – The layout object to be formatted. - stream (file like object, optional) – The stream where formatted data will be written. Defaults to
sys.stdout
- recursive (boolean, optional) – If True, recursively print the entire layout tree underneath box.
- box (
-
toyplot.text.
extents
(text, angle, style)[source]¶ Compute canvas coordinate extents for a text string, based on the given angle and style.
-
toyplot.text.
layout
(text, style, fonts)[source]¶ Convert text with markup into a layout that is ready to be rendered.
Parameters: - text (string, required) – Text with markup to be converted.
- style (dict, required) – Collection of CSS properties to be used as defaults for the text layout.
- fonts (
toyplot.font.Library
, required) – Font library that will supply font information for the text layout.
Returns: layout – The text layout contains a hierarchy of styled, positiioned nodes that are ready to be rendered.
Return type: