Skip to content

Commit

Permalink
Merge pull request #1143 from hugovk/pr1123fixup
Browse files Browse the repository at this point in the history
Fix TabError from PR #1123
  • Loading branch information
hugovk committed Mar 21, 2015
2 parents f820c51 + b17384c commit d25a8d7
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions PIL/ImageFont.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,19 +168,20 @@ def getmask2(self, text, mode="", fill=Image.core.fill):
return im, offset

def font_variant(self, font=None, size=None, index=None, encoding=None):
"""
Create a copy of this 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.
:return: A FreeTypeFont object.
"""
return FreeTypeFont(font = self.path if font == None else font,
size = self.size if size == None else size,
index = self.index if index == None else index,
encoding = self.encoding if encoding == None else encoding)
"""
Create a copy of this 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.
:return: A FreeTypeFont object.
"""
return FreeTypeFont(font=self.path if font is None else font,
size=self.size if size is None else size,
index=self.index if index is None else index,
encoding=self.encoding if encoding is None else
encoding)

##
# Wrapper that creates a transposed font from any existing font
Expand Down Expand Up @@ -275,8 +276,8 @@ def truetype(font=None, size=10, index=0, encoding="", filename=None):
elif sys.platform in ('linux', 'linux2'):
lindirs = os.environ.get("XDG_DATA_DIRS", "")
if not lindirs:
#According to the freedesktop spec, XDG_DATA_DIRS should
#default to /usr/share
# According to the freedesktop spec, XDG_DATA_DIRS should
# default to /usr/share
lindirs = '/usr/share'
lindirs = lindirs.split(":")
for lindir in lindirs:
Expand All @@ -286,7 +287,8 @@ def truetype(font=None, size=10, index=0, encoding="", filename=None):
filepath = os.path.join(walkroot, ttf_filename)
return FreeTypeFont(filepath, size, index, encoding)
elif sys.platform == 'darwin':
macdirs = ['/Library/Fonts/', '/System/Library/Fonts/', os.path.expanduser('~/Library/Fonts/')]
macdirs = ['/Library/Fonts/', '/System/Library/Fonts/',
os.path.expanduser('~/Library/Fonts/')]
for macdir in macdirs:
filepath = os.path.join(macdir, ttf_filename)
if os.path.exists(filepath):
Expand Down

0 comments on commit d25a8d7

Please sign in to comment.