Manim 中文字体使用指南:解决'text_font'属性错误
在 Manim 版本 0.11.0 及更早的版本中,没有'text_font'属性。要在 Manim 中使用中文字体,可以使用 MathTex 对象,并指定字体文件的路径。
以下是使用 MathTex 对象和中文字体的示例代码:
from manim import *
from manim import MathTex
class CircleToSquare(Scene):
def construct(self):
equation = MathTex(r'这是一个中文文本')
self.play(Write(equation))
self.wait()
if __name__ == "__main__":
scene = CircleToSquare()
scene.render()
请确保将字体文件的路径更改为您计算机上实际的中文字体文件路径。
原文地址: https://www.cveoy.top/t/topic/qzxi 著作权归作者所有。请勿转载和采集!