mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-03 21:24:31 +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.fill = 0
|
||||||
self.font = None
|
self.font = None
|
||||||
|
|
||||||
##
|
|
||||||
# Set the default font.
|
|
||||||
|
|
||||||
def setfont(self, font):
|
def setfont(self, font):
|
||||||
|
if warnings:
|
||||||
|
warnings.warn("setfont() is deprecated. " +
|
||||||
|
"Please set the attribute directly instead.")
|
||||||
# compatibility
|
# compatibility
|
||||||
self.font = font
|
self.font = font
|
||||||
|
|
||||||
|
|
|
@ -223,11 +223,11 @@ try:
|
||||||
font, orientation=orientation)
|
font, orientation=orientation)
|
||||||
|
|
||||||
# Original font
|
# Original font
|
||||||
draw.setfont(font)
|
draw.font = font
|
||||||
box_size_a = draw.textsize(word)
|
box_size_a = draw.textsize(word)
|
||||||
|
|
||||||
# Rotated font
|
# Rotated font
|
||||||
draw.setfont(transposed_font)
|
draw.font = transposed_font
|
||||||
box_size_b = draw.textsize(word)
|
box_size_b = draw.textsize(word)
|
||||||
|
|
||||||
# Check (w,h) of box a is (h,w) of box b
|
# Check (w,h) of box a is (h,w) of box b
|
||||||
|
@ -245,11 +245,11 @@ try:
|
||||||
font, orientation=orientation)
|
font, orientation=orientation)
|
||||||
|
|
||||||
# Original font
|
# Original font
|
||||||
draw.setfont(font)
|
draw.font = font
|
||||||
box_size_a = draw.textsize(word)
|
box_size_a = draw.textsize(word)
|
||||||
|
|
||||||
# Rotated font
|
# Rotated font
|
||||||
draw.setfont(transposed_font)
|
draw.font = transposed_font
|
||||||
box_size_b = draw.textsize(word)
|
box_size_b = draw.textsize(word)
|
||||||
|
|
||||||
# Check boxes a and b are same size
|
# Check boxes a and b are same size
|
||||||
|
|
Loading…
Reference in New Issue
Block a user