Skip to content

Support font features/language in default RendererBase.draw_text#31461

Open
QuLogic wants to merge 2 commits intomatplotlib:text-overhaulfrom
QuLogic:default-features
Open

Support font features/language in default RendererBase.draw_text#31461
QuLogic wants to merge 2 commits intomatplotlib:text-overhaulfrom
QuLogic:default-features

Conversation

@QuLogic
Copy link
Copy Markdown
Member

@QuLogic QuLogic commented Apr 7, 2026

PR summary

If a backend doesn't implement draw_text, then we fall back to this implementation that draws paths. It was previously missing support for font features and languages.

Unfortunately, there is currently no way to test this, as all our internal renderers override draw_text, and not using it would produce completely different images due to paths rendering differently than FreeType's images.

You can manually test this by renaming RendererAgg.draw_text and then running, e.g., pytest lib/matplotlib/tests/test_text.py -k 'language or feature'

I put together a test that does exactly that using monkey patching to ensure we use the fallback path.

AI Disclosure

None

PR checklist

If a backend doesn't implement `draw_text`, then we fall back to this
implementation that draws paths. It was previously missing support for
font features and languages.
This exercises complex shaping, font features, and language support.
@QuLogic QuLogic force-pushed the default-features branch from 882d947 to 4461ad7 Compare April 7, 2026 08:02
@QuLogic QuLogic moved this from Waiting for other PR to Ready for Review in Font and text overhaul Apr 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Ready for Review

Development

Successfully merging this pull request may close these issues.

2 participants