Skip to content

MarkupText: Use Cairo to handle gradients #33

Description

@PhilippImhof

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requesthelp wantedExtra attention is needed

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions