ManimCommunity / ManimCommunity/manim
Paragraph doesn't calculate newlines and character positions correctly with ligatures enabled
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 40.9k
- Forks
- 3.1k
- Avg merge
- 3d 12h
- Merged PRs (30d)
- 25
Description
## Description of bug / unexpected behavior
When using a Paragraph with text with ligatures and newlines, character positions are wrong.
## Expected behavior
Characters should get rendered correctly, as they do without ligatures.
## How to reproduce the issue
Code for reproducing the problem
```py
class Example(Scene):
def construct(self):
# The font must have ligatures that apply to the character sequences in the text, of course.
# Most fonts have 'fi' and 'tt' ligatures though.
wrong = Paragraph(
'ffifififi\nfififitt tttfj', disable_ligatures=False, alignment='center', font='Candara', weight=LIGHT).shift(UP*2)
right = Paragraph(
'ffifififi\nfififitt tttfj', disable_ligatures=True, alignment='center', font='Candara', weight=LIGHT).shift(DOWN*2)
self.add(wrong, right)
```
## Additional media files
Images/GIFs

Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Paragraph usage in the Example.construct reproduction and compare the ligatures-enabled and disabled cases, especially across the newline. Trace how Paragraph calculates character positions for the shown text. Done means the ligatures-enabled rendering matches the disabled case for character placement and line breaks.
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
- 42/100