FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Use more specific patterns for bundled mathtext fonts by QuLogic · Pull Request #32302 · matplotlib/matplotlib · GitHub

Repository navigation

Use more specific patterns for bundled mathtext fonts - #32302

Open
QuLogic wants to merge 2 commits into
matplotlib:mainfrom
QuLogic:mathtext-fonts
Open

QuLogic wants to merge 2 commits into
matplotlib:mainfrom
QuLogic:mathtext-fonts

Conversation

QuLogic commented Sep 5, 2026

Copy link
Copy Markdown
Member

PR summary

Because we previously only asked for a font family (and sometimes a weight/style), mathtext fonts were at the whim of rcParams for all other settings. This could mean that we would look for an non-existent weight, or even set the normal font to italic unintentionally.

The fonts that are available for mathtext are (for now) fixed and bundled, and we only intend for them to work with the exact fonts we have. So use more specific fontconfig patterns that should always match the fonts that we have.

While it could be possible to simply hard-code these paths relative to our data path, it seems that way back in 157a059, that implementation was changed to findfont intentionally to avoid duplicate embeddings.

Also remove a redundant test.

AI Disclosure

None

PR quality check

  • Use an expressive title, e.g. "Fix title font property precedence"
  • New and changed code is tested
  • [n/a] Plotting related features are demonstrated in an example
  • [n/a] New features and API changes have release notes
  • [n/a] Documentation complies with general and docstring guidelines

QuLogic added this to the v3.11.2 milestone Sep 5, 2026
QuLogic linked an issue Sep 5, 2026 that may be closed by this pull request
QuLogic force-pushed the mathtext-fonts branch 3 times, most recently from 83feec5 to 49bb96e Compare September 5, 2026 07:30
This test just checks `get_sfnt_table('head')` for DejaVu Sans, but
there is a more comprehensive test of all SFNT tables in
`test_ft2font.py::test_ft2font_get_sfnt_table`.
Because we previously only asked for a font family (and sometimes a
weight/style), mathtext fonts were at the whim of rcParams for all other
settings. This could mean that we would look for an non-existent weight,
or even set the normal font to italic unintentionally.

The fonts that are available for mathtext are (for now) fixed and
bundled, and we only intend for them to work with the exact fonts we
have. So use more specific fontconfig patterns that should always match
the fonts that we have.

While it could be possible to simply hard-code these paths relative to
our data path, it seems that way back in
157a059, that implementation was
changed to `findfont` intentionally to avoid duplicate embeddings.
QuLogic modified the milestones: v3.11.2, v3.11.3 Sep 9, 2026

iccir left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I reviewed this last week but seemingly forgot to hit the Submit button.

This branch has not been deployed

No deployments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Font lookup when rendering math text

3 participants


Back | FazBrowse Home | New Git URL