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.LineBox(style)[source]

Bases: object

Container for one line of text.

class toyplot.text.MarkerBox(marker, style)[source]

Bases: object

Container for a Toyplot marker specification.

Bases: object

Marks the end of a hyperlink.

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
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

toyplot.text.Layout