ManimCommunity / ManimCommunity/manim

Paragraph doesn't calculate newlines and character positions correctly with ligatures enabled

Open
#2,968 1 comment 0 reactions 0 assignees View on GitHub

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

![Example_ManimCE_v0 16 0 post0](https://user-images.githubusercontent.com/28656157/192304871-e3cf3b2d-bc6b-4cc3-88e3-c084691b4c3e.png)

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 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.