From 3841a11fb58dc5db10a4bc854e28d958b7e976c8 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Mon, 13 Jul 2015 17:39:34 +1000 Subject: [PATCH] Removed ImageFont filename param, deprecated in 2.1 --- PIL/ImageFont.py | 22 +++------------------- Tests/test_imagefont.py | 5 ----- 2 files changed, 3 insertions(+), 24 deletions(-) diff --git a/PIL/ImageFont.py b/PIL/ImageFont.py index e3fb6f503..fce44caff 100644 --- a/PIL/ImageFont.py +++ b/PIL/ImageFont.py @@ -121,15 +121,8 @@ class ImageFont(object): class FreeTypeFont(object): "FreeType font wrapper (requires _imagingft service)" - def __init__(self, font=None, size=10, index=0, encoding="", file=None): + def __init__(self, font=None, size=10, index=0, encoding=""): # FIXME: use service provider instead - if file: - if warnings: - warnings.warn( - 'file parameter deprecated, ' - 'please use font parameter instead.', - DeprecationWarning) - font = file self.path = font self.size = size @@ -171,7 +164,7 @@ class FreeTypeFont(object): using any specified arguments to override the settings. Parameters are identical to the parameters used to initialize this - object, minus the deprecated 'file' argument. + object. :return: A FreeTypeFont object. """ @@ -225,7 +218,7 @@ def load(filename): return f -def truetype(font=None, size=10, index=0, encoding="", filename=None): +def truetype(font=None, size=10, index=0, encoding=""): """ Load a TrueType or OpenType font file, and create a font object. This function loads a font object from the given file, and creates @@ -243,19 +236,10 @@ def truetype(font=None, size=10, index=0, encoding="", filename=None): Symbol), "ADOB" (Adobe Standard), "ADBE" (Adobe Expert), and "armn" (Apple Roman). See the FreeType documentation for more information. - :param filename: Deprecated. Please use font instead. :return: A font object. :exception IOError: If the file could not be read. """ - if filename: - if warnings: - warnings.warn( - 'filename parameter deprecated, ' - 'please use font parameter instead.', - DeprecationWarning) - font = filename - try: return FreeTypeFont(font, size, index, encoding) except IOError: diff --git a/Tests/test_imagefont.py b/Tests/test_imagefont.py index 1fd70b3d8..09f4942a7 100644 --- a/Tests/test_imagefont.py +++ b/Tests/test_imagefont.py @@ -88,11 +88,6 @@ try: self._render(f) self._clean() - def test_font_old_parameters(self): - self.assert_warning( - DeprecationWarning, - lambda: ImageFont.truetype(filename=FONT_PATH, size=FONT_SIZE)) - def _render(self, font): txt = "Hello World!" ttf = ImageFont.truetype(font, FONT_SIZE)