Layout#

Qualified name: manimpango.Layout

class Layout(text=None, markup=None, font_desc=None)#

A Layout class represents an entire paragraph of text.

Layout provides a high-level driver for formatting entire paragraphs of text at once. This includes paragraph-level functionality such as line breaking, justification, alignment and ellipsization.

A Layout is initialized with a str. The layout can then be rendered. There are a number of parameters to adjust the formatting of a Layout.

When both markup and text is set the behavior is unknown.

Parameters
  • text (str) – The text to be set, by default None.

  • markup (str) – The text encoded in PangoMarkup, by default None.

  • font_desc (manimpango.fonts.FontDescription) – The font description to be used while rendering.

Examples

>>> import manimpango as mp
>>> mp.Layout("hello world")
<Layout text='hello world' markup=None>
Raises

ValueError – If both text and markup is None.

Parameters

Methods

property height: int#

The height to which the text should be ellipsized at.

Raises

TypeError – If height is not a int.

property markup: str#

The markup (in pango markup format) to render.

Raises
property text: str#

The text to render.

Raises

TypeError – If text is not a str.

property width: int#

The width to which the text should be wrapped or ellipsized.

Raises

TypeError – If width is not a int.