Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document the text attribute mappings in the Text initializer #4086

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions manim/mobject/text/text_mobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,22 @@ class Text(SVGMobject):
warn_missing_font
If True (default), Manim will issue a warning if the font does not exist in the
(case-sensitive) list of fonts returned from `manimpango.list_fonts()`.
t2c
A dictionary mapping substrings in the text to colors. These will be resolved
the same way they would by `set_color`. May also be provided as `text2color`.
t2f
A dictionary mapping substrings in the text to fonts. These will be resolved
the same way the `font` parameter is. May also be provided as `text2font`.
t2g
A dictionary mapping substrings in the text to gradients, specified as an iterable
of color strings. These will be resolved the same way `set_color_by_gradient` is.
May also be provided as `text2gradient`.
t2s
A dictionary mapping substrings in the text to slant values. May be
NORMAL (the default), ITALIC, or OBLIQUE. May also be provided as `text2slant`.
t2w
A dictionary mapping substrings in the text to font weight values, listed in
`manimpango.Weight`. May also be provided as `text2weight`.

Returns
-------
Expand Down Expand Up @@ -433,9 +449,9 @@ def __init__(
font: str = "",
slant: str = NORMAL,
weight: str = NORMAL,
t2c: dict[str, str] = None,
t2c: dict[str, ParsableManimColor] = None,
t2f: dict[str, str] = None,
t2g: dict[str, tuple] = None,
t2g: dict[str, Iterable[ParsableManimColor]] = None,
t2s: dict[str, str] = None,
t2w: dict[str, str] = None,
gradient: tuple = None,
Expand Down
Loading