A newer version of the Gradio SDK is available: 6.20.0
text_mobject
Mobjects used for displaying (non-LaTeX) text.
NOTE
Just as you can use Tex and MathTex (from the module tex_mobject)
to insert LaTeX to your videos, you can use Text to to add normal text.
IMPORTANT
See the corresponding tutorial Text Without LaTeX, especially for information about fonts.
The simplest way to add text to your animations is to use the Text class. It uses the Pango library to render text.
With Pango, you are also able to render non-English alphabets like 你好 or こんにちは or 안녕하세요 or مرحبا بالعالم.
Examples
Classes
MarkupText |
Display (non-LaTeX) text rendered using Pango. |
|---|---|
Paragraph |
Display a paragraph of text. |
Text |
Functions
register_font(font_file)
Temporarily add a font file to Pango’s search path.
This searches for the font_file at various places. The order it searches it described below.
- Absolute path.
- In
assets/fontsfolder. - In
font/folder. - In the same directory.
- Parameters: font_file (str | Path) – The font file to add.
- Return type: Iterator[None]
Examples
Use with register_font(...) to add a font file to search
path.
with register_font("path/to/font_file.ttf"):
a = Text("Hello", font="Custom Font Name")
- Raises:
- FileNotFoundError: – If the font doesn’t exists.
- AttributeError: – If this method is used on macOS.
- .. important :: – This method is available for macOS for
ManimPango>=v0.2.3. Using this method with previous releases will raise anAttributeErroron macOS.
- Parameters: font_file (str | Path)
- Return type: Iterator[None]
remove_invisible_chars(mobject)
Function to remove unwanted invisible characters from some mobjects.
- Parameters: mobject (VMobject) – Any SVGMobject from which we want to remove unwanted invisible characters.
- Returns: The SVGMobject without unwanted invisible characters.
- Return type:
SVGMobject