-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Specify font number for TTC font subsetting #22284
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
d03ec3e
to
6022e3b
Compare
|
||
# if fontfile is a ttc, specify font number | ||
if fontfile.endswith(".ttc"): | ||
options.font_number = 0 |
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.
This is extracting from the first font in the collection correct?
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 believe so; the count starts from 0.
Can you add a comment about why this works? Do we have access to any ttc fonts on CI so we can test this? |
It should be possible to add a ttc-file, e.g. embedding the existing ttf-file (and possibly another ttf-file, just to actually make it a collection of ttfs, I can probably make an additional ttf with a single glyph or something...). |
Oh, there is a test for ttc already, so there is a ttc font available for testing. matplotlib/lib/matplotlib/tests/test_font_manager.py Lines 113 to 120 in 940cc2c
Based on #9787 it seems like the first font is already selected, even though it is not clear from the code how that happens. |
6022e3b
to
1b78020
Compare
@meeseeksdev backport to v3.5.x |
…284-on-v3.5.x Backport PR #22284 on branch v3.5.x (Specify font number for TTC font subsetting)
PR Summary
Since #20804 isn't merged yet, the commit 1b53070 can go as a hotfix for #21893.
PR Checklist
Tests and Styling
pytest
passes).flake8-docstrings
and runflake8 --docstring-convention=all
).