Skip to content

CairoText not working with strings that are longer than 30 lines #745

@ChristianCoenen

Description

@ChristianCoenen

Description of bug / unexpected behavior

When I read a file of any text that is longer than 30 lines and use the resulting string to create a CairoText object, the creation crashes with the exception shown below. Standard setup as described in the documentation (Windows 10). But I think it has nothing to do with the setup.

How to reproduce the issue

from manim import *

class Test(Scene):
    def construct(self):
        with open("<path to file that has more than 30 lines>") as f:
            code_raw = f.read()

        code = CairoText(code_raw)

Logs

Traceback (most recent call last):
  File "C:\Users\Chris\Documents\repos\manim\manim\__main__.py", line 75, in main
    scene.render()
  File "C:\Users\Chris\Documents\repos\manim\manim\scene\scene.py", line 88, in render
    self.construct()
  File "test.py", line 10, in construct
    code = CairoText(code_raw)
  File "C:\Users\Chris\Documents\repos\manim\manim\mobject\svg\text_mobject.py", line 136, in __init__
    self.submobjects = [*self.gen_chars()]
  File "C:\Users\Chris\Documents\repos\manim\manim\mobject\svg\text_mobject.py", line 187, in gen_chars
    chars.add(self.submobjects[submobjects_char_index])
IndexError: list index out of range

Process finished with exit code 0

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue:bugSomething isn't working... For use in issues

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions