Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Move pangoText example from example script to Docs (#533)

kolibril13e0d62d7388ec
diff --git a/example_scenes/pangoText.py b/example_scenes/pangoText.py
deleted file mode 100644
index 1a14e5705..000000000
--- a/example_scenes/pangoText.py
+++ /dev/null
@@ -1,41 +0,0 @@
-from manim import *
-
-
-class PangoRendering(Scene):
- CONFIG = {"font": "sans-serif"}
-
- def construct(self):
- morning = PangoText("வணக்கம்", font="sans-serif")
- self.play(Write(morning))
- self.wait(3)
- self.clear()
- chin = PangoText(
- "見 角 言 谷 辛 辰 辵 邑 酉 釆 里!", t2c={"見 角 言": BLUE}
- ) # works same as ``Text``.
- self.play(Write(chin))
- self.wait(2)
- mess = PangoText("Multi-Language", style=BOLD)
- self.play(Transform(chin, mess))
- self.wait(2)
- self.clear()
- russ = PangoText("Здравствуйте मस नम म ", font="sans-serif")
- self.play(Write(russ))
- self.wait(2)
- self.clear()
- hin = PangoText("नमस्ते", font="sans-serif")
- self.play(Write(hin))
- self.wait(2)
- self.clear()
- arb = PangoText("صباح الخير ", font="sans-serif")
- self.play(Write(arb))
- self.wait(3)
- self.clear()
- arb = PangoText(
- "صباح الخير \n تشرفت بمقابلتك", font="sans-serif"
- ) # don't mix RTL and LTR languages nothing shows up then ;-)
- self.play(Write(arb))
- self.wait(3)
- self.clear()
- jap = PangoText("臂猿「黛比」帶著孩子", font="sans-serif")
- self.play(Write(jap))
- self.wait(3)
diff --git a/manim/mobject/svg/text_mobject.py b/manim/mobject/svg/text_mobject.py
index 76c7ab7cd..a05ba6e75 100644
--- a/manim/mobject/svg/text_mobject.py
+++ b/manim/mobject/svg/text_mobject.py
@@ -582,7 +582,7 @@ class Paragraph(VGroup):
class PangoText(SVGMobject):
- """Display (non-LaTeX) text rendered using `Pango <https://pango.gnome.org/>`_.
+ r"""Display (non-LaTeX) text rendered using `Pango <https://pango.gnome.org/>`_.
PangoText objects behave like a :class:`.VGroup`-like iterable of all characters
in the given text. In particular, slicing is possible.
@@ -598,7 +598,28 @@ class PangoText(SVGMobject):
The mobject like :class:`.VGroup`.
Examples
- --------
+ ---------
+ .. manim:: MultipleFonts
+ :save_last_frame:
+
+ class MultipleFonts(Scene):
+ def construct(self):
+ morning = PangoText("வணக்கம்", font="sans-serif")
+ chin = PangoText(
+ "見 角 言 谷 辛 辰 辵 邑 酉 釆 里!", t2c={"見 角 言": BLUE}
+ ) # works same as ``Text``.
+ mess = PangoText("Multi-Language", style=BOLD)
+ russ = PangoText("Здравствуйте मस नम म ", font="sans-serif")
+ hin = PangoText("नमस्ते", font="sans-serif")
+ arb = PangoText(
+ "صباح الخير \n تشرفت بمقابلتك", font="sans-serif"
+ ) # don't mix RTL and LTR languages nothing shows up then ;-)
+ japanese = PangoText("臂猿「黛比」帶著孩子", font="sans-serif")
+ self.add(morning,chin,mess,russ,hin,arb,japanese)
+ for i,mobj in enumerate(self.mobjects):
+ mobj.shift(DOWN*(i-3))
+
+
.. manim:: PangoRender
:quality: low