Skip to content

RFC: Refactor rendering API and native font pipeline for v1.0.0 - #129

Draft
behackl wants to merge 55 commits into
ManimCommunity:v0from
behackl:rewrite-v2
Draft

RFC: Refactor rendering API and native font pipeline for v1.0.0#129
behackl wants to merge 55 commits into
ManimCommunity:v0from
behackl:rewrite-v2

Conversation

@behackl

@behackl behackl commented Aug 4, 2026

Copy link
Copy Markdown
Member

Summary

This PR replaces the existing rendering interface with a smaller, explicit v1 API
and consolidates rendering around immutable results, SVG-space geometry, and
renderer-owned font state.

I don't intend to merge this branch, just started development at v0 at some point
and did not want to rebase against main (which has two previous 1.0.0 pre-releases
already) -- but should probably merged into / replace main while creating a v1
release branch. At that point I'd probably also change the default branch of this repo.

It is probably quite obvious, but I want to be explicit about it: this has been cooked up
with extensive usage of LLMs; I've kept (coarsely) reviewing individual commits and
in particular the test suite though. Not included: the integration of the new interface
in Manim -- but it effectively warrants a complete rewrite of Text and friends like
Paragraph to get rid of all the old, ugly and effectively unmaintainable code. I strongly
believe that the current redesign allows a much, much cleaner implementation of
multi-line text in particular within Manim (while at the same time, or so I hope at least,
forming a more maintainable interface here). Curious to hear what you think!

The main public entry points in this refactored version are:

  • render() for literal plain text
  • render_markup() for Pango markup
  • TextSpan for structured plain-text styling
  • RenderedText, Bounds, and LineInfo for SVG output and layout metadata
  • register_font() / FontRegistration for explicit custom-font lifetimes
  • get_version_info() for linked-library version information

Design highlights

  • Plain text and markup are deliberately separate paths; plain text is never
    interpreted as markup.
  • All public geometry, including font sizes, uses SVG user-space units.
  • Render results and spans are immutable value objects.
  • Font registration is reference-counted, renderer-owned, and isolated from
    unrelated Linux Fontconfig application state.
  • Markup is parsed once per render and shared across measurement and SVG output.
  • Span normalization and line metadata handling now scale linearly or near
    linearly for large styled or multiline inputs.
  • Native error handling and cleanup paths were tightened, including Cairo status
    checks and explicit rejection of NUL-containing native inputs.

Infrastructure and documentation

  • CI, wheel validation, release triggering, packaging metadata, and docs were
    modernized alongside the API work.
  • Documentation includes the migration and breaking-change overview; this PR
    description intentionally stays focused on the implementation shape.

Verification

  • Full test suite, docs/doctests, linting, wheel smoke tests, and the current
    cross-platform CI matrix are green.

@behackl behackl changed the title RFC: Refactor rendering API and native font pipeline for v1 RFC: Refactor rendering API and native font pipeline for v1.0.0 Aug 4, 2026
@behackl

behackl commented Aug 4, 2026

Copy link
Copy Markdown
Member Author

To ease into this patchbomb (sorry!), I can recommend starting with the explicit changelog page in the documentation at https://manimpango--129.org.readthedocs.build/en/129/changelog.html, followed by reading test output.

This also modernises the CI/CD pipeline, the actual checks are currently not reported on this PR -- but you should be able to see them over at my fork: https://github.com/behackl/ManimPango/actions.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant