From 8293fe0aa7de04341be60fc47bdc08996ca3548b Mon Sep 17 00:00:00 2001 From: Robin Norwood Date: Fri, 17 Nov 2017 12:41:05 -0600 Subject: [PATCH 1/2] Update docs to reflect that font can be loaded from a stream, not just by filename --- PIL/ImageFont.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/PIL/ImageFont.py b/PIL/ImageFont.py index 19977b8bd..ab3b8c022 100644 --- a/PIL/ImageFont.py +++ b/PIL/ImageFont.py @@ -233,15 +233,16 @@ def load(filename): def truetype(font=None, size=10, index=0, encoding="", layout_engine=None): """ - Load a TrueType or OpenType font file, and create a font object. - This function loads a font object from the given file, and creates - a font object for a font of the given size. + Load a TrueType or OpenType font from a file or stream, and create + a font object. + This function loads a font object from the given file or stream, + and creates a font object for a font of the given size. This function requires the _imagingft service. - :param font: A truetype font file. Under Windows, if the file - is not found in this filename, the loader also looks in - Windows :file:`fonts/` directory. + :param font: A filename or binary stream containing a TrueType font. + Under Windows, if the file is not found in this filename, + the loader also looks in Windows :file:`fonts/` directory. :param size: The requested size, in points. :param index: Which font face to load (default is first available face). :param encoding: Which font encoding to use (default is Unicode). Common From e3e6da5e35b519fa7881af5c529bef4f0e3a89dd Mon Sep 17 00:00:00 2001 From: Robin Norwood Date: Mon, 20 Nov 2017 09:00:23 -0600 Subject: [PATCH 2/2] Change wording from 'stream' to 'file-like object. --- PIL/ImageFont.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/PIL/ImageFont.py b/PIL/ImageFont.py index ab3b8c022..732e6ad7a 100644 --- a/PIL/ImageFont.py +++ b/PIL/ImageFont.py @@ -233,14 +233,14 @@ def load(filename): def truetype(font=None, size=10, index=0, encoding="", layout_engine=None): """ - Load a TrueType or OpenType font from a file or stream, and create - a font object. - This function loads a font object from the given file or stream, - and creates a font object for a font of the given size. + Load a TrueType or OpenType font from a file or file-like object, + and create a font object. + This function loads a font object from the given file or file-like + object, and creates a font object for a font of the given size. This function requires the _imagingft service. - :param font: A filename or binary stream containing a TrueType font. + :param font: A filename or file-like object containing a TrueType font. Under Windows, if the file is not found in this filename, the loader also looks in Windows :file:`fonts/` directory. :param size: The requested size, in points.