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

Don't set a default size for FT2Font#30319

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
tacaswell merged 1 commit intomatplotlib:text-overhaulfromQuLogic:ft2font-size
Jul 16, 2025

Conversation

QuLogic
Copy link
Member

PR summary

In the interest of handling non-scalable fonts and reducing font initialization, drop the default size from theFT2Font constructor. Non-scalable fonts are sometimes used for bitmap-backed emoji fonts. When we start supporting collection fonts (.ttc), then setting a size is a waste, as we will just need to read the count of fonts within.

The renderer methodRenderer.draw_text always sets a size immediately after creating the font object, so this doesn't affect anything in most cases. Only the directFT2Font tests need changes.

I'm only unsure whether we wish to somehow warn/deprecate when this the size isn't set explicitly.

PR checklist

In the interest of handling non-scalable fonts and reducing fontinitialization, drop the default size from the `FT2Font` constructor.Non-scalable fonts are sometimes used for bitmap-backed emoji fonts.When we start supporting collection fonts (`.ttc`), then setting a sizeis a waste, as we will just need to read the count of fonts within.The renderer method `Renderer.draw_text` always sets a size immediatelyafter creating the font object, so this doesn't affect anything in mostcases. Only the direct `FT2Font` tests need changes.
@github-project-automationgithub-project-automationbot moved this toWaiting for other PR inFont and text overhaulJul 16, 2025
@QuLogicQuLogic moved this fromWaiting for other PR toReady for Review inFont and text overhaulJul 16, 2025
Copy link
Contributor

@anntzeranntzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Emitting a warning would seem quite tedious to do.

@timhoffm
Copy link
Member

Would it make sense to add an optionalsize parameter to the constructor so that one does not have to do a separateset_size() call? i.e. optionally initialize as part of construction.

@tacaswell
Copy link
Member

Given that the target consumer of Font objects is thedraw method of ourText classes and they already have to always set the font size (you can't trust that it came in with the right size) I'm in favor of waiting for a user to have a need for this outside of our tests.

@tacaswelltacaswell merged commit7dae1e5 intomatplotlib:text-overhaulJul 16, 2025
36 checks passed
@github-project-automationgithub-project-automationbot moved this fromReady for Review toDone inFont and text overhaulJul 16, 2025
@QuLogicQuLogic deleted the ft2font-size branchJuly 16, 2025 23:06
@QuLogicQuLogic added this to thev3.11.0 milestoneJul 16, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@tacaswelltacaswelltacaswell approved these changes

@anntzeranntzeranntzer approved these changes

Assignees
No one assigned
Projects
Status: Done
Milestone
v3.11.0
Development

Successfully merging this pull request may close these issues.

4 participants
@QuLogic@timhoffm@tacaswell@anntzer

[8]ページ先頭

©2009-2025 Movatter.jp