GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Font and text overhaul by QuLogic · Pull Request #30161 · matplotlib/matplotlib

Conversation

@QuLogic

@QuLogic QuLogic commented Jun 10, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

PR summary

This PR is intended to hold all font and text PRs from the project Font and text overhaul

In order to not overwhelm the main repo with the churn of test image replacements, this PR comes from my fork and should only ever have 1 commit more than the text-overhaul branch with the changes to test images.

This includes images changes for the following pull requests / commits:

  • Fix center of rotation with rotation_mode='anchor' (c44db77)
  • Remove ttconv backwards-compatibility code (8caff88)
  • Remove kerning_factor from tests (7b4d725)
  • Set text hinting to defaults (8255ae2)
  • Update FreeType to 2.13.3 (89c054d)
  • Implement text shaping with libraqm (b0ded3a, 9813523)
  • Add language parameter to Text objects (7ce8eae)
  • Fix auto-sized glyphs with BaKoMa fonts (3ba2c13)
  • pdf: Improve text with characters outside embedded font limits (b70fb88, 6cedcf7)
  • Prepare CharacterTracker for advanced font features (8274e17, 70dc388, df670cf, ed5e074)
  • Add font feature API to Text (972a688)
  • Fix spacing in r"$\max f$" (4a99a83)
  • Implement libraqm for vector outputs (bd17cd4)
  • Drop the FT2Font intermediate buffer (9d7d7b4)
  • Rasterize dvi files without dvipng (7627118)
  • Update bundled FreeType and HarfBuzz libraries (a161658, 9619bcc)
  • Fix positioning of wide mathtext accents (c2fa7ba)
  • Refactor RendererAgg.draw_{mathtext,text,tex} to use same base algorithm (931bcf3)
  • Implement TeX's fraction and script alignment (94ff452, 4bfa0f9, 1cd8510)
  • Fix confusion between text height and ascent in metrics calculations (60f2310)
  • mathtext: Fetch quad width & axis height from font metrics (692df3f, 383028b)
  • mathtext: add mathnormal and distinguish between normal and italic family (a6913f3)
  • ENH: Ignore empty text for tightbbox (d772043)
  • Drop axis_artist tickdir image compat, due to text-overhaul merge (2057583)
  • text: Use font metrics to determine line heights (3ab6a27, d961462, 97f4943)
  • ps/pdf: Override font height metrics to support AFM files (e0913d4)
  • TST: Cleanup back-compat code in tests touched by text overhaul (7c33379)
  • TST: Set tests touched by text overhaul to mpl20 style (41c4d8d)

PR checklist

  • [n/a] "closes #0000" is in the body of the PR description to link the related issue
  • new and changed code is tested
  • Plotting related features are demonstrated in an example
  • New Features and API Changes are noted with a directive and release note
  • Documentation complies with general and docstring guidelines

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
anntzer and others added 3 commits June 5, 2025 03:33
@anntzer @QuLogic
Remove ttconv backwards-compatibility code
8caff88
Wiliam @QuLogic
Fix center of rotation with rotation_mode='anchor'
c44db77
@QuLogic
Merge pull request matplotlib#29199 from WPurre/fixing-rotation-bug
f1cdc19
Fix center of rotation with rotation_mode='anchor'
@QuLogic QuLogic added this to the v3.11.0 milestone Jun 10, 2025
@QuLogic QuLogic added the status: waiting for other PR label Jun 10, 2025
@QuLogic QuLogic added this to Font and text overhaul Jun 10, 2025
@github-project-automation github-project-automation Bot moved this to Waiting for other PR in Font and text overhaul Jun 10, 2025
@github-actions github-actions Bot added topic: mplot3d backend: agg labels Jun 10, 2025
QuLogic added 4 commits June 12, 2025 18:46
@QuLogic
Remove fallback code for glyph indices
41cc933
Glyph indices are specific to each font. It does not make sense to fall
back based on glyph index to another font.

This could only really be populated by calling `FT2Font.set_text`, but
even that was fragile. If a fallback font was used for a character with
the same glyph index as a previous character in the main font, then
these lookups could be overwritten to the fallback instead of the main
font, with a completely different character!

Fortunately, nothing actually uses or requires a fallback through glyph
indices.
@QuLogic
Merge pull request matplotlib#30145 from QuLogic/remove-ttconv
7dafe63
Remove ttconv backwards-compatibility code
@QuLogic
Merge pull request matplotlib#30168 from QuLogic/no-glyph-fallback
67d1a02
Remove fallback code for glyph indices
@QuLogic
Merge branch 'main' into text-overhaul
bb9aae4
@QuLogic
QuLogic force-pushed the text-overhaul-figures branch from 045897c to e4be26c Compare June 19, 2025 22:15
@github-actions github-actions Bot added topic: path handling backend: pdf topic: text/fonts labels Jun 19, 2025
@QuLogic
QuLogic force-pushed the text-overhaul-figures branch from e4be26c to 2b3f5c5 Compare June 19, 2025 22:25
@QuLogic

QuLogic commented Jun 19, 2025

Copy link
Copy Markdown
Member Author

Also, if you would like to follow along with the figure changes, I've posted a branch that does the changes per merge commit: https://github.com/QuLogic/matplotlib/tree/text-overhaul-figures-per-commit

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@QuLogic QuLogic mentioned this pull request Jun 26, 2025
Fixed several accuracy bugs with image resampling #30184
Merged
1 task done
QuLogic added 8 commits July 7, 2025 19:06
@QuLogic
Merge branch 'main' into text-overhaul
a7fd524
@QuLogic
ci: Preload existing test images from text-overhaul-figures branch
389373e
This allows checking that there are no _new_ failures, without
committing the new figures to the repo until the branch is complete.
@QuLogic
Merge pull request matplotlib#30231 from QuLogic/preload-ci
4d47644
ci: Preload existing test images from text-overhaul-figures branch
@QuLogic
Add typing to AFM parser
a018606
Also, check some expected conditions at parse time instead of somewhere
during use of the data.
@QuLogic
ci: Fix image preload with multiple conflicts
aff20cf
@QuLogic
Merge pull request matplotlib#30274 from QuLogic/fix-preload
572540d
ci: Fix image preload with multiple conflicts
@QuLogic
Merge pull request matplotlib#30134 from QuLogic/afm-typing
f231f2e
Add typing to AFM parser
@QuLogic
Remove kerning_factor from tests
7b4d725
@QuLogic
QuLogic force-pushed the text-overhaul-figures branch from 2b3f5c5 to b17bef1 Compare July 10, 2025 04:06
@github-actions github-actions Bot added the backend: ps label Jul 10, 2025
ksunden and others added 19 commits March 27, 2026 13:27
@ksunden
Merge pull request matplotlib#31183 from Cemonix/fix-font-alt-family-…
4efa3c0
…names

ENH: Allow fonts to be addressed by any of their SFNT family names
@QuLogic
Merge pull request matplotlib#31372 from QuLogic/raqm0104
b10b22c
BLD: Update bundled libraqm to 0.10.4
@QuLogic @tacaswell @timhoffm
BLD: Update bundled FreeType to 2.14.3 (matplotlib#31407)
38e3921
* BLD: Update bundled FreeType to 2.14.3

These releases mostly consist of security fixes.

* BLD: adjust upstream url for freetype to nongnu savanah mirror

Co-authored-by: Tim Hoffmann <[email protected]>

---------

Co-authored-by: Thomas A Caswell <[email protected]>
Co-authored-by: Tim Hoffmann <[email protected]>
@QuLogic
Merge branch 'main' into text-overhaul
ec84112
@QuLogic
Fix wasm build on text-overhaul branch
4b4660e
- Port FreeType symbol visibility patch to 2.14.1
- Add test image preloading to wasm CI workflow
- Temporarily disable testing `test_complex_shaping`, which triggers
  some code path that fails somehow
@QuLogic
TST: Skip test_animation.py::test_failing_ffmpeg on wasm builds
17b1f31
This test requires a subprocess call, so should be skipped like the
others.
@QuLogic
Fix FreeType runtime version check
0b4e787
Unfortunately, this was missed in matplotlib#31407.
@QuLogic
TST: Cleanup back-compat code in tests touched by text overhaul
7c33379
These tests had previously kept some code or settings to prevent
regenerating the test image, but since they are now going to be
regenerated from the text overhaul, we can remove those.
@QuLogic
Merge pull request matplotlib#31295 from QuLogic/test-cleanup
2e0fee1
TST: Cleanup back-compat code in tests touched by text overhaul
@QuLogic
Merge pull request matplotlib#31440 from QuLogic/fix-ft-check
417784e
Fix FreeType runtime version check
@anntzer
Clarify fonttype switch in backend_pdf.
dbf8c17
Make it clearer that switches are only over 3 possible fonttypes (1, 3,
42).  In draw_text, the logic is easier to follow if one directly
switches over rcParams['pdf.use14corefonts']; this requires putting the
url handling at the end, which doesn't matter.
@QuLogic
TST: Set tests touched by text overhaul to mpl20 style (matplotlib#31300
41c4d8d
)

* TST: Set tests touched by text overhaul to mpl20 style

* TST: Tweak some tests to work better in mpl20 style
@QuLogic
Merge pull request matplotlib#31456 from anntzer/pdfft
49bb098
Clarify fonttype switch in backend_pdf.
@QuLogic
Support font features/language in default RendererBase.draw_text
9059da7
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.
@QuLogic
TST: Add a test for RendererBase.draw_text
4461ad7
This exercises complex shaping, font features, and language support.
@QuLogic
TST: Reset tolerances on tests changed by text overhaul
bca638d
@tacaswell
Merge pull request matplotlib#31303 from QuLogic/reset-tolerance
ba56e3d
TST: Reset tolerances on tests changed by text overhaul
@ksunden
Merge pull request matplotlib#31461 from QuLogic/default-features
8672cf9
Support font features/language in default RendererBase.draw_text
@QuLogic
Update test images for font/text overhaul
12d2a4d
This includes images changes for the following pull requests / commits:

* [Fix center of rotation with
  rotation_mode='anchor'](matplotlib#29199)
  (c44db77)
* [Remove ttconv backwards-compatibility
  code](matplotlib#30145)
  (8caff88)
* [Remove kerning_factor from
  tests](matplotlib#29816)
  (7b4d725)
* [Set text hinting to
  defaults](matplotlib#29816)
  (8255ae2)
* [Update FreeType to
  2.13.3](matplotlib#29816)
  (89c054d)
* [Implement text shaping with
  libraqm](matplotlib#30000)
  (b0ded3a,
  9813523)
* [Add language parameter to Text
  objects](matplotlib#29794)
  (7ce8eae)
* [Fix auto-sized glyphs with BaKoMa
  fonts](matplotlib#29936)
  (3ba2c13)
* [pdf: Improve text with characters outside embedded font
  limits](matplotlib#30512)
  (b70fb88,
  6cedcf7)
* [Prepare `CharacterTracker` for advanced font
  features](matplotlib#30608)
  (8274e17,
  70dc388,
  df670cf,
  ed5e074)
* [Add font feature API to
  Text](matplotlib#29695)
  (972a688)
* [Fix spacing in r"$\max
  f$"](matplotlib#30715)
  (4a99a83)
* [Implement libraqm for vector
  outputs](matplotlib#30607)
  (bd17cd4)
* [Drop the FT2Font intermediate
  buffer](matplotlib#30059)
  (9d7d7b4)
* [Rasterize dvi files without
  dvipng](matplotlib#30039)
  (7627118)
* [Update bundled FreeType and HarfBuzz
  libraries](matplotlib#30938)
  (a161658,
  9619bcc)
* [Fix positioning of wide mathtext
  accents](matplotlib#31069)
  (c2fa7ba)
* [Refactor RendererAgg.draw_{mathtext,text,tex} to use same base
  algorithm](matplotlib#31085)
  (931bcf3)
* [Implement TeX's fraction and script
  alignment](matplotlib#31046)
  (94ff452,
  4bfa0f9,
  1cd8510)
* [Fix confusion between text height and ascent in metrics
  calculations](matplotlib#31107)
  (60f2310)
* [mathtext: Fetch quad width & axis height from font
  metrics](matplotlib#31110)
  (692df3f,
  383028b)
* [mathtext: add mathnormal and distinguish between normal and italic
  family](matplotlib#31121)
  (a6913f3)
* [ENH: Ignore empty text for
  tightbbox](matplotlib#31285)
  (d772043)
* [Drop axis_artist tickdir image compat, due to text-overhaul
  merge](matplotlib#31281)
  (2057583)
* [text: Use font metrics to determine line
  heights](matplotlib#31291)
  (3ab6a27,
  d961462,
  97f4943)
* [ps/pdf: Override font height metrics to support AFM
  files](matplotlib#31371)
  (e0913d4)
* [TST: Cleanup back-compat code in tests touched by text
  overhaul](matplotlib#31295)
  (7c33379)
* [TST: Set tests touched by text overhaul to mpl20
  style](matplotlib#31300)
  (41c4d8d)
@QuLogic

QuLogic commented Apr 10, 2026

Copy link
Copy Markdown
Member Author

I've now rebased the final figures onto the latest text-overhaul commit, compressed all the new PNGs with oxipng, and annotated the last commit/PR description with the sources for the changes.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

tacaswell
tacaswell reviewed Apr 10, 2026
View reviewed changes
Comment thread lib/matplotlib/testing/__init__.py
mpl.rcParams['font.family'] = 'DejaVu Sans'
mpl.rcParams['text.hinting'] = 'none'
mpl.rcParams['text.hinting_factor'] = 8
# We've changed the default for ourselves here, but for backwards-compatibility, use

@tacaswell tacaswell Apr 10, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to give downstream a way to control this?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@tacaswell tacaswell Apr 10, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

per discussion we can likely always go with the new values.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
tacaswell
tacaswell reviewed Apr 10, 2026
View reviewed changes
Comment thread lib/matplotlib/tests/test_axes.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

tacaswell
tacaswell approved these changes Apr 10, 2026
View reviewed changes
ksunden
ksunden approved these changes Apr 10, 2026
View reviewed changes
@tacaswell

tacaswell commented Apr 10, 2026

Copy link
Copy Markdown
Member

Going to let Elliott click merge on this monster!

neutrinoceros reacted with laugh emoji QuLogic reacted with hooray emoji
All reactions
  • 😄 1 reaction
  • 🎉 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jklymak

jklymak commented Apr 10, 2026

Copy link
Copy Markdown
Member

Congratulations on this @QuLogic and thank you for all your hard work to get this in, and everyone who helped review. This was a heroic effort!

QuLogic reacted with thumbs up emoji rcomer reacted with hooray emoji rcomer reacted with rocket emoji
All reactions
  • 👍 1 reaction
  • 🎉 1 reaction
  • 🚀 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@QuLogic QuLogic mentioned this pull request Apr 10, 2026
MNT: Use new defaults in set_font_settings_for_testing #31484
Merged
This was referenced Apr 11, 2026
TST: bump mpldev image test references astropy/astropy#19562
Merged
Fix devdeps figure-test CI yet again sunpy/sunpy#8578
Merged
@neutrinoceros neutrinoceros mentioned this pull request Sep 1, 2026
TST: ignore shape-mutation deprecation warnings from numpy 2.5 on yt 4.4.x yt-project/yt#5518
Merged
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@tacaswell tacaswell tacaswell approved these changes
@ksunden ksunden ksunden approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

backend: agg backend: cairo backend: pdf backend: pgf backend: ps backend: svg CI: Run cibuildwheel Run wheel building tests on a PR topic: canvas and figure manager topic: mplot3d topic: path handling topic: rcparams topic: styles topic: text/fonts topic: text/mathtext topic: text topic: transforms and scales

Projects

Font and text overhaul
Status: Done

Milestone

v3.11.0

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

10 participants

@QuLogic @sanrishi @tacaswell @jklymak @ksunden @anntzer @tfpf @llohse @scottshambaugh @Cemonix
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.