2.3.3. Text Output (layout.elements.text)

class layout.elements.text.Paragraph(text, width, font_name='Helvetica', font_size=11, color=(0, 0, 0), leading=1.3, paragraph_indent=True)

Bases: layout.elements.text.TextBase

A paragraph of text that will be fit in the given width.

Because this class has a specific width it does not scale to fit with the room it is given. It may therefore overlap surrounding content unless it is wrapped in a scaling layout manager.

get_minimum_size(data)

How small can the element be? Should return a Point.

render(rect, data)

Asks the element to render itself.

class layout.elements.text.TextBase(font_name='Helvetica', font_size=11, color=(0, 0, 0), align=0)

Bases: layout.managers.root.LayoutElement

Base class of things that track their font, color and alignment.

class layout.elements.text.TextBlock(lines, font_name='Helvetica', font_size=11, color=(0, 0, 0), align=0, gap=5)

Bases: layout.elements.text.TextBase

A set of simple text lines. Each line in the list can be prepended with a + sign to make it bold.

get_minimum_size(data)

How small can the element be? Should return a Point.

render(rect, data)

Asks the element to render itself.

class layout.elements.text.TextLine(text, font_name='Helvetica', font_size=11, color=(0, 0, 0), align=0)

Bases: layout.elements.text.TextBase

An unsplittable line of text formatted in a single font and size.

get_minimum_size(data)

How small can the element be? Should return a Point.

render(rect, data)

Asks the element to render itself.