Added deprecation warning to ImageDraw setfont method, as specified in docs

This commit is contained in:
Andrew Murray 2015-09-19 21:12:10 +10:00
parent baa5143394
commit 5835c1e09c
2 changed files with 7 additions and 7 deletions

View File

@ -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

View File

@ -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