mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-25 00:34:14 +03:00
Added deprecation warning to ImageDraw setfont method, as specified in docs
This commit is contained in:
parent
baa5143394
commit
5835c1e09c
|
@ -90,10 +90,10 @@ class ImageDraw(object):
|
|||
self.fill = 0
|
||||
self.font = None
|
||||
|
||||
##
|
||||
# Set the default font.
|
||||
|
||||
def setfont(self, font):
|
||||
if warnings:
|
||||
warnings.warn("setfont() is deprecated. " +
|
||||
"Please set the attribute directly instead.")
|
||||
# compatibility
|
||||
self.font = font
|
||||
|
||||
|
|
|
@ -223,11 +223,11 @@ try:
|
|||
font, orientation=orientation)
|
||||
|
||||
# Original font
|
||||
draw.setfont(font)
|
||||
draw.font = font
|
||||
box_size_a = draw.textsize(word)
|
||||
|
||||
# Rotated font
|
||||
draw.setfont(transposed_font)
|
||||
draw.font = transposed_font
|
||||
box_size_b = draw.textsize(word)
|
||||
|
||||
# Check (w,h) of box a is (h,w) of box b
|
||||
|
@ -245,11 +245,11 @@ try:
|
|||
font, orientation=orientation)
|
||||
|
||||
# Original font
|
||||
draw.setfont(font)
|
||||
draw.font = font
|
||||
box_size_a = draw.textsize(word)
|
||||
|
||||
# Rotated font
|
||||
draw.setfont(transposed_font)
|
||||
draw.font = transposed_font
|
||||
box_size_b = draw.textsize(word)
|
||||
|
||||
# Check boxes a and b are same size
|
||||
|
|
Loading…
Reference in New Issue
Block a user