{{ message }}
Use more specific patterns for bundled mathtext fonts - #32302
Open
QuLogic wants to merge 2 commits into
Open
Conversation
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`.
QuLogic
force-pushed
the
mathtext-fonts
branch
2 times, most recently
from
September 5, 2026 06:45
6d04047 to
83feec5
Compare
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
force-pushed
the
mathtext-fonts
branch
from
September 5, 2026 07:30
83feec5 to
49bb96e
Compare
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
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.

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
findfontintentionally to avoid duplicate embeddings.Also remove a redundant test.
AI Disclosure
None
PR quality check