Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[MNT]: Replace TextPath by Text().to_path() #30546

@anntzer

Description

@anntzer

Summary

TextPath is a Path subclass with a different constructor (from a string, that gets converted to path representation), with the further ability to mutate itself by changing its size (but not anything else). Inheritance from Paths has led to an issue related to deep-copying (#29157).

Proposed fix

The TextPath class could be replaced by a Text(...).to_path() -> Path method. This would be easier to document (no ad-hoc class).
to_path() would not allow changing the size of the text but users could just mutate the Text object and call to_path() again, which is likely more correct (due to optical sizing a size-12 text is not necessarily just a 2x magnification of a size-6 text); or, if this is really a performance bottleneck, they could rescale the path vertices themselves (which is what TextPath does in _revalidate_path).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions