ManimCommunity / ManimCommunity/ManimPango

MarkupText: Use Cairo to handle gradients

Open
#33 3 comments 0 reactions 1 assignee View on GitHub

Nobody has claimed this yet.

enhancement help wanted
Dominant language
Python
Stars
62
Forks
22
PR merge metrics
No merged PRs in 30d

Description

## Enhancement proposal

When using gradients in `MarkupText` we have Pango render the text to an SVG. We then load the SVG into a `SVGMobject` and apply the gradient to the characters. This has two major drawbacks:

- the gradient is done on a per-character basis, i.e. every character has one solid color; the quality of the gradient therefore depends largely on the length of the text to which it is applied
- with ligatures, the number of paths does not correspond to the number of characters, so the user will have to specify an offset to compensate for this, e.g. `fl` counts for two characters but might be rendered as a single glyph
- similar problems arise with underline, double underline, overline and strikethrough, because those lines will also be sub-paths of the `SVGMobject`

We will have to be careful w.r.t. the `Write` animation. Currently, even with gradients every character has its own color. If the character is itself colored with a gradient, what color is to be used for the stroke?

Contributor guide

No contributing guide indexed for this repository

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.