用曼尼姆语书写不同的语言



我想在Manim中动画化一些用不同语言编写的单词。当我使用英语时,一切都很好,但当我试图呈现用不同语言编写的单词时,我会收到UnicodeEncodeError。有办法绕过这个吗?提前感谢

class TextOnTopEdge(Scene):
def construct(self):
first_line=TextMobject("আয়ান")
second_line=TextMobject("What do you think?")
second_line.next_to(first_line,DOWN)
third_line=TextMobject("Poncho will tell the stories ")
third_line.next_to(first_line,DOWN)
fourth_line=TextMobject("And Shelly will handle the visual thingies ")
fourth_line.next_to(third_line,DOWN)
fifth_line=TextMobject("PATH TO GLORY!!!!")
fifth_line.next_to(first_line,UP,buff=1)
self.add_sound("sound")
self.add(first_line, second_line)
self.wait(3)
self.play(Transform(second_line,third_line))
self.wait(3)
self.play(Transform(third_line,fourth_line))
self.wait(3)
self.play(Transform(fourth_line,fifth_line))
self.wait(3)

以上部分是代码

"UnicodeEncodeError:‘charmap’编解码器无法对522-525位置的字符进行编码:字符映射到">

这就是错误。

Manim是一个数学动画引擎,因此在很大程度上依赖于LaTeX。LaTeX使用英文字体,并且只能接受英文文本。可以将字体添加到Manim中。我还在TeX stackexchange上发现了一个问题,专门讨论在LaTeX中使用孟加拉语。顶部链接的帖子提供了一个链接,指向您需要的字体。祝你好运

使用Text()而不是TextMobject()我修复了一些错误。从这里使用它,并从这里替换你的manim文件夹中的适当文件

并确保你使用适当的字体为给定的语言,如在答案中所述

最新更新