Skip to content
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

Allow default ImageDraw font to be set #6484

Merged
merged 3 commits into from Aug 15, 2022

Conversation

radarhere
Copy link
Member

Resolves #6480

By raising ImageDraw.ImageDraw.font from an instance variable to a class variable, a default ImageDraw font can be set by the user.

from PIL import ImageDraw, ImageFont
ImageDraw.ImageDraw.font = ImageFont.truetype("Tests/fonts/FreeMono.ttf", 120)

From then on, ImageDraw operations would use that font as the default, instead of the ImageFont.load_default() font.

Copy link
Member

@hugovk hugovk left a comment

Choose a reason for hiding this comment

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

Fair enough, let's add this to the release notes.

@radarhere
Copy link
Member Author

Ok, done

docs/releasenotes/9.3.0.rst Outdated Show resolved Hide resolved
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
@hugovk hugovk merged commit 87ecd01 into python-pillow:main Aug 15, 2022
@radarhere radarhere deleted the imagedraw_font branch August 15, 2022 05:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support setting a default font
2 participants