Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
oscargus merged 2 commits intomatplotlib:mainfromaitikgupta:fix/ttc-font-subset
Apr 14, 2022

Conversation

aitikgupta
Copy link
Contributor

PR Summary

Since#20804 isn't merged yet, the commit1b53070 can go as a hotfix for#21893.

PR Checklist

Tests and Styling

  • Has pytest style unit tests (andpytest passes).
  • IsFlake 8 compliant (installflake8-docstrings and runflake8 --docstring-convention=all).

@QuLogicQuLogic added this to thev3.5.2 milestoneJan 25, 2022
@QuLogicQuLogic linked an issueJan 25, 2022 that may beclosed by this pull request

# if fontfile is a ttc, specify font number
if fontfile.endswith(".ttc"):
options.font_number = 0
Copy link
Member

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?

Copy link
Member

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.

@tacaswell
Copy link
Member

Can you add a comment about why this works? Do we have access to any ttc fonts on CI so we can test this?

@oscargus
Copy link
Member

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...).

@oscargus
Copy link
Member

oscargus commentedMar 4, 2022
edited
Loading

Oh, there is a test for ttc already, so there is a ttc font available for testing.

deftest_find_ttc():
fp=FontProperties(family=["WenQuanYi Zen Hei"])
ifPath(findfont(fp)).name!="wqy-zenhei.ttc":
pytest.skip("Font wqy-zenhei.ttc may be missing")
fig,ax=plt.subplots()
ax.text(.5,.5,"\N{KANGXI RADICAL DRAGON}",fontproperties=fp)
forfmtin ["raw","svg","pdf","ps"]:
fig.savefig(BytesIO(),format=fmt)

Based on#9787 it seems like the first font is already selected, even though it is not clear from the code how that happens.

@oscargusoscargus merged commitc1bf6df intomatplotlib:mainApr 14, 2022
@oscargus
Copy link
Member

@meeseeksdev backport to v3.5.x

meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull requestApr 14, 2022
QuLogic added a commit that referenced this pull requestApr 14, 2022
…284-on-v3.5.xBackport PR#22284 on branch v3.5.x (Specify font number for TTC font subsetting)
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@QuLogicQuLogicQuLogic left review comments

@tacaswelltacaswelltacaswell approved these changes

@oscargusoscargusoscargus approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
v3.5.2
Development

Successfully merging this pull request may close these issues.

[Bug]:backend_pdf givesTTLibError withpdf.fonttype : 42
4 participants
@aitikgupta@tacaswell@oscargus@QuLogic

[8]ページ先頭

©2009-2025 Movatter.jp