Skip to contents

A VMobject that renders text as Bezier outlines. Uses systemfonts for font discovery and textshaping for glyph layout. Each glyph becomes a submobject (VMobject) so individual letters can be animated.

Details

Unlike Python Manim which uses Cairo/Pango, manimR uses R-native systemfonts + textshaping for cross-platform font support. When these packages are unavailable, falls back to a simple bounding-box placeholder.

Super classes

manimR::MObject -> manimR::VMobject -> Text

Public fields

text

The text string

font

Font family name

font_size

Font size in manimR units (default 48 ~ DEFAULT_FONT_SIZE)

weight

Font weight ("normal", "bold")

slant

Font slant ("normal", "italic", "oblique")

line_spacing

Multiplier for line spacing

alignment

Text alignment ("left", "center", "right")

gradient

Optional color gradient across glyphs

glyphs

List of per-glyph VMobjects (submobjects)

Methods

Inherited methods


Method new()

Create a new Text object

Usage

Text$new(
  text,
  font = "sans",
  font_size = DEFAULT_FONT_SIZE,
  color = WHITE,
  weight = "normal",
  slant = "normal",
  line_spacing = 1.2,
  alignment = "center",
  gradient = NULL,
  position = ORIGIN,
  ...
)

Arguments

text

The text string to render

font

Font family (default "sans")

font_size

Size in manimR units (default DEFAULT_FONT_SIZE)

color

Text color

weight

Font weight

slant

Font slant

line_spacing

Line spacing multiplier

alignment

Text alignment

gradient

Optional color gradient (vector of colors)

position

Position in scene

...

Additional args passed to VMobject


Method get_text()

Get text as string

Usage

Text$get_text()


Method set_text()

Set new text (rebuilds geometry)

Usage

Text$set_text(new_text)

Arguments

new_text

New text string


Method get_glyph()

Get the i-th glyph (1-indexed) as a VMobject

Usage

Text$get_glyph(i)

Arguments

i

Index of the glyph


Method slice()

Slice a range of glyphs (returns a VGroup)

Usage

Text$slice(from, to)

Arguments

from

Start index (1-indexed)

to

End index (1-indexed, inclusive)


Method set_color_by_gradient()

Apply a color gradient across all glyphs

Usage

Text$set_color_by_gradient(colors)

Arguments

colors

Vector of color hex strings


Method num_glyphs()

Get number of visible glyphs (excluding spaces)

Usage

Text$num_glyphs()


Method clone()

The objects of this class are cloneable with this method.

Usage

Text$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.