Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Add font.superfamily support with genre-aware resolution#30155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Conversation
Closesmatplotlib#29866This commit adds support for rcParam 'font.superfamily',allowing users to define logical font groups (superfamilies)that span multiple genres like 'serif', 'sans', and 'mono'.Each superfamily maps genre + weight + style to real fontnames using keys like 'bold-italic' or 'normal-normal'.Font resolution uses genre from font.family and matchesagainst the selected superfamily, trying exact and fallbackvariants in order of specificity to generality.Superfamilies can be defined by name (preloaded registry)or passed as inline dicts in rcParams['font.superfamily'].Legacy behavior is preserved unless superfamily is set.If set, genre-aware matching replaces generic family name.Includes defaults for DejaVu, Noto, Liberation, and more.Co-authored-by: Tiago Marques <tiago.l.marques@tecnico.ulisboa.pt>
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.
I still don't know if we really want that feature, but if we do, it would definitely not by using a hard-coded table, but more likely by extracting the relevant metadata from the font files.
Ok, I'll look into that. About the part of extracting metadata, is it worth to add more dependencies to mpl ? |
Hopefully it can be done without additional dependencies. |
We already have |
Closes#29866
Adds support for rcParam 'font.superfamily', allowing users to define logical font groups (superfamilies) that span multiple genres like 'serif', 'sans', and 'mono'.
Each superfamily maps genre + weight + style to real font names using keys like 'bold-italic' or 'normal-normal'.
Font resolution uses genre from font.family and matches against the selected superfamily, trying exact and fallback variants in order of specificity to generality.
Superfamilies can be defined by name (preloaded registry) or passed as inline dicts in rcParams['font.superfamily'].
Legacy behavior is preserved unless superfamily is set. If set, genre-aware matching replaces generic family name.
Includes defaults for DejaVu, Noto, Liberation, and more.
PR summary
PR checklist