diff --git a/fabulous/text.py b/fabulous/text.py index 32315d6..02572cf 100644 --- a/fabulous/text.py +++ b/fabulous/text.py @@ -115,7 +115,10 @@ def __init__(self, text, fsize=23, color="#0099ff", shadow=False, self.color = grapefruit.Color.NewFromHtml(color) self.font = ImageFont.truetype(resolve_font(font), fsize) skew = skew or 0 - size = tuple([n + 3 + skew for n in self.font.getsize(self.text)]) + if hasattr(font, 'getsize'): + size = tuple([n + 3 + skew for n in self.font.getsize(self.text)]) + else: + size = tuple([n + 3 + skew for n in self.font.getbbox(self.text)[2:4]]) self.img = Image.new("RGBA", size, (0, 0, 0, 0)) cvs = ImageDraw.Draw(self.img) if shadow: