ManimCommunity / ManimCommunity/manim

`Code` mobject does not support ligatures

Open
#3,237 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

issue:bug
Dominant language
Python
Stars
40.9k
Forks
3.1k
Avg merge
3d 12h
Merged PRs (30d)
25

Description

## Description of bug / unexpected behavior

I'm working with Code mobject. I was getting started with this [https://docs.manim.community/en/stable/reference/manim.mobject.text.code_mobject.Code.html#codefromstring](example) and I found this.

When I add line `print("Hello World")`, it works fine. But when I add `print(1<2)` or `print("Hello World", 1<2)`, an error occur.

I'm not sure it happened with other `language` or not.

```python
from manim import *

class CodeFromString(Scene):
def construct(self):
code = """from manim import Scene, Square

class FadeInSquare(Scene):
def construct(self):
print(1<=2)
s = Square()
self.play(FadeIn(s))
self.play(s.animate.scale(2))
self.wait()
"""
rendered_code = Code(
code=code,
tab_width=4,
background="window",
language="Python",
font="FiraCode Nerd Font",
)
self.play(Create(rendered_code))

```

## Logs

```
IndexError: list index out of range
```

And btw, what would be nice if you teach me how to apply `fontLigasture` when render

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Code mobject and the linked CodeFromString documentation example, then reproduce the IndexError using the supplied Python snippet with `print(1<=2)`. Trace the code-rendering path to determine why ligatures or comparison operators exceed the available glyph data. Done means the example renders without IndexError and the expected font-ligature behavior is documented or supported.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
computer-graphics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.