Skip to content

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

Co-authored-by: Hugo van Kemenade <[email protected]>
@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