ManimCommunity / ManimCommunity/manim
Character spacing/overlap/kerning bug after escape characters in `Paragraph` when using non-default `alignment` argument
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 `alignment` in the arguments for `Paragraph` (e.g. `alignment='left'`), character overlap occurs after escaped characters (e.g. `\n`, `\t`). This doesn't occur when omitting the `alignment` argument entirely (although this **still left aligns text** by default - that is to say, omitting `alignment` and using `alignment='left'` should have the same effect but don't).
## Expected behavior
No character overlap after newlines, tabs, etc. when using non-default `alignment` arguments.
## How to reproduce the issue
Code for reproducing the problem
```py
class UsingParagraph(Scene):
def construct(self):
paragraph = Paragraph('nothing', 'With \nNewlines', '\tWith Tabs')
self.play(Create(paragraph))
self.wait()
self.play(Uncreate(paragraph))
paragraph = Paragraph('alignment=""', 'With \nNewlines', '\tWith Tabs', alignment='')
self.play(Create(paragraph))
self.wait()
self.play(Uncreate(paragraph))
paragraph = Paragraph('alignment="left"', 'With \nNewlines', '\tWith Tabs', alignment='left')
self.play(Create(paragraph)) # HERE WE GET THE BUG WITH CHARACTER OVERLAP
self.wait()
self.play(Uncreate(paragraph))
paragraph = Paragraph('alignment="right"', 'With \nNewlines', '\tWith Tabs', alignment='right')
self.play(Create(paragraph)) # THIS WOULD ALSO APPEAR TO BE A VARIATION OF THE BUG
self.wait()
self.play(Uncreate(paragraph))
paragraph = Paragraph('alignment="left", no ligatures', 'With \nNewlines', '\tWith Tabs', alignment='left', disable_ligatures=True)
self.play(Create(paragraph)) # NEWLINES AND TABS ENTIRELY REMOVED BY DISABLE LIGATURES AS EXPECTED
self.wait()
self.play(Uncreate(paragraph))
```
## Additional media files
Images/GIFs

## Additional comments
It's highly likely this bug is related to #2366 and would likely be solved in the rewrite proposed in #2355
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
Reproduce the issue with the supplied UsingParagraph scene, then inspect Paragraph handling for explicit alignment and escaped newlines or tabs while comparing it with the omitted-alignment case. Review related issues #2366 and #2355; done means the scene renders without character overlap for the demonstrated alignments.
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
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100