1

我想在 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 中的字符进行编码:字符映射到”

这就是错误。

4

2 回答 2

0

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

于 2020-04-29T09:38:18.833 回答
0

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

并确保您对该答案中提到的给定语言使用适当的字体

于 2020-06-20T22:44:05.643 回答