Fix unexpected keyword argument 'align'

This commit is contained in:
Hugo 2017-07-23 23:58:05 +03:00
parent 10c7e20045
commit ff81201971

View File

@ -36,6 +36,7 @@ class _imagingft_not_installed(object):
def __getattr__(self, id): def __getattr__(self, id):
raise ImportError("The _imagingft C module is not installed") raise ImportError("The _imagingft C module is not installed")
try: try:
from . import _imagingft as core from . import _imagingft as core
except ImportError: except ImportError:
@ -113,7 +114,6 @@ class ImageFont(object):
return self.font.getmask(text, mode) return self.font.getmask(text, mode)
## ##
# Wrapper for FreeType fonts. Application code should use the # Wrapper for FreeType fonts. Application code should use the
# <b>truetype</b> factory function to create font objects. # <b>truetype</b> factory function to create font objects.
@ -162,7 +162,7 @@ class FreeTypeFont(object):
def getmask(self, text, mode="", direction=None, features=None): def getmask(self, text, mode="", direction=None, features=None):
return self.getmask2(text, mode, direction=direction, features=features)[0] return self.getmask2(text, mode, direction=direction, features=features)[0]
def getmask2(self, text, mode="", fill=Image.core.fill, direction=None, features=None): def getmask2(self, text, mode="", fill=Image.core.fill, direction=None, features=None, *args, **kwargs):
size, offset = self.font.getsize(text, direction, features) size, offset = self.font.getsize(text, direction, features)
im = fill("L", size, 0) im = fill("L", size, 0)
self.font.render(text, im.id, mode == "1", direction, features) self.font.render(text, im.id, mode == "1", direction, features)
@ -250,7 +250,7 @@ def truetype(font=None, size=10, index=0, encoding="",
and "armn" (Apple Roman). See the FreeType documentation and "armn" (Apple Roman). See the FreeType documentation
for more information. for more information.
:param layout_engine: Which layout engine to use, if available: :param layout_engine: Which layout engine to use, if available:
`ImageFont.LAYOUT_BASIC` or `ImageFont.LAYOUT_RAQM`. `ImageFont.LAYOUT_BASIC` or `ImageFont.LAYOUT_RAQM`.
:return: A font object. :return: A font object.
:exception IOError: If the file could not be read. :exception IOError: If the file could not be read.
""" """