Specify font number for TTC font subsetting#22284
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.
This is extracting from the first font in the collection correct?
There was a problem hiding this comment.
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
pytestpasses).flake8-docstringsand runflake8 --docstring-convention=all).