ManimCommunity / ManimCommunity/manim

Bad kerning in `Text()`

Open
#2,844 15 comments 0 reactions 0 assignees View on GitHub
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 `Text()` or `Paragraph()`, the spacing between letters is generally off regardless of the choice of the font. This is probably an issue with Pango.

See the attached images.

## Expected behavior

The spacing between the letters should be more balanced and evenly distributed.

## How to reproduce the issue

Code for reproducing the problem

```py
class DemoScene(Scene):
def construct(self):
paragraph = Paragraph(
"""
Lorem ipsum dolor sit amet, consectetur adipiscing elit,
sed do eiusmod tempor incididunt ut labore et dolore
magna aliqua. Ut enim ad minim veniam, quis nostrud.""",
font="Helvetica", font_size=32, line_spacing = 0.5
)
self.add(paragraph)
```

## Additional media files

Images/GIFs

![image](https://user-images.githubusercontent.com/93129268/175085934-27bcf9b4-2ea3-4a79-bace-ae1b0798469f.png)
![image](https://user-images.githubusercontent.com/93129268/175088197-f2cfca93-1491-46fd-ba3c-27de0dfc3cc2.png)

## Logs
Terminal output

```
PASTE HERE OR PROVIDE LINK TO https://pastebin.com/ OR SIMILAR
```

## System specifications

System Details

I rendered it using the Manimator in the Manim Community Server. The version is 0.15.2

- OS (with version, e.g., Windows 10 v2004 or macOS 10.15 (Catalina)):
- RAM:
- Python version (`python/py/python3 --version`):
- Installed modules (provide output from `pip list`):
```
PASTE HERE
```

LaTeX details

+ LaTeX distribution (e.g. TeX Live 2020):
+ Installed LaTeX packages:

FFMPEG

Output of `ffmpeg -version`:

```
PASTE HERE
```

## Additional comments

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the supplied DemoScene using Text() or Paragraph() with the shown font and line spacing, then compare the rendered letter spacing across fonts. Investigate the text-rendering path and the suspected Pango interaction. Done means the reproduced output has balanced, consistent spacing without regressing other text rendering.

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
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.