to use utf-8 encoding

in colab install this fork
This commit is contained in:
Sabbir Hasan Munna 2022-12-14 14:41:19 +06:00 committed by GitHub
parent f4b1244213
commit 1434128357
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -151,6 +151,7 @@ class ImageFont:
:return: (width, height)
"""
deprecate("getsize", 10, "getbbox or getlength")
text = text.encode("utf-8")
return self.font.getsize(text)
def getmask(self, text, mode="", *args, **kwargs):
@ -171,6 +172,7 @@ class ImageFont:
:return: An internal PIL storage memory instance as defined by the
:py:mod:`PIL.Image.core` interface module.
"""
text = text.encode("utf-8")
return self.font.getmask(text, mode)
def getbbox(self, text, *args, **kwargs):