Open HumbleHumbert opened 2 years ago
right, I tried both MikTex and Texlive, the latter worked few years ago. But neither now.
I can run your code without any error:
And notice that Text
doesn't use LaTeX to generate svg file, it uses pango. Tex
and TexText
use LaTeX, and if you want to use it generate non-English text, you may have to modify the config file and using xelatex
as tex executable instead of latex
.
Yes, I have seen your solution somewhere, and I went to the file C:\Users\unrul\manim\manimlib\default_config.yml . And did as
tex:
executable: "xelatex -no-pdf"
template_file: "ctex_template.tex"
intermediate_filetype: "xdv"
text_to_replace: "[tex_expression]"
# For ctex, use the following configuration
# executable: "xelatex -no-pdf"
# template_file: "ctex_template.tex"
# intermediate_filetype: "xdv"
only to get the result
(process:2736): Pango-WARNING **: 11:51:39.163: couldn't load font "Source Han Sans Not-Rotated 48", falling back to "Sans Not-Rotated 48", expect ugly output.
c:\users\unrul\manim\manimlib\utils\space_ops.py:155: RuntimeWarning: invalid value encountered in double_scalars
cos_angle = np.dot(v1, v2) / np.float64(n1 * n2)
Traceback (most recent call last):
File "D:\Programming\Anaconda3\envs\manim\Scripts\manimgl-script.py", line 33, in <module>
sys.exit(load_entry_point('manimgl', 'console_scripts', 'manimgl')())
File "c:\users\unrul\manim\manimlib\__main__.py", line 25, in main
scene.run()
File "c:\users\unrul\manim\manimlib\scene\scene.py", line 91, in run
self.construct()
File "ppw.py", line 13, in construct
text = Text(script, font='Source Han Sans')
File "c:\users\unrul\manim\manimlib\mobject\svg\text_mobject.py", line 149, in __init__
super().__init__(text, **kwargs)
File "c:\users\unrul\manim\manimlib\mobject\svg\labelled_string.py", line 65, in __init__
self.post_parse()
File "c:\users\unrul\manim\manimlib\mobject\svg\labelled_string.py", line 122, in post_parse
self.group_items = self.get_group_items()
File "c:\users\unrul\manim\manimlib\mobject\svg\labelled_string.py", line 414, in get_group_items
ordered_spans = [
File "c:\users\unrul\manim\manimlib\mobject\svg\labelled_string.py", line 415, in <listcomp>
self.label_span_list[label] if label != -1 else self.full_span
IndexError: list index out of range
ending with the same IndexError. Looks like something to do with the Pango? And btw I enabled the UTF-8 Beta for Chinese if that matters.
Have you installed the font Source Han Sans ?
I got a same problem too.
@NolanWY : Have you installed the font Source Han Sans ?
I think it is not the reason. I tried with another font which I had, but the problem appeared again.
However, I found that it worked well if I deleted the Chinese characters. That means the following #ffeBe9
code didn't work but the #dafbe1
code worked well.
- script = 'Hello 你好'
+ script = 'Hello'
text = Text(script,font = "LXGWWenKai")
I had the same problem. But when I specified the font to be used in the code, it became normal.
+ text = Text("我是一个 Text", font = "Source Han Sans"
- text = Text("我是一个 Text")
I think it would be helpful to specify a different font.
After I chose another font and replaced the name of it as the font
in the code, the problem seems to be resolved for me.
class Demo(Scene):
def construct(self):
script = 'Hello 你好'
- text = Text(scrtpt,font = 'LXGWWenKai')
+ text = Text(scrtpt,font = 'HarmonyOS Sans SC Light')
self.play(Write(text))
self.wait()
In addition, It's inconvenient to use a font with non-English name. manimpango.list_fonts()
will help you.
Describe the error
I recently installed manimgl on an env of Annaconda using python3.9. And met with this problem when trying to relize the last example in #680
Code and Error
Code:
is what the .py
then
manimgl ***.py Demo
Error:
Environment
win 10: manim 1.6.1: master python 3.9:
And actually, after I tried, it happens every time when I try to put any non-English languages in the
Text
, and all ended up the sameIndexError: list index out of range
Can I get any help?