mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-08-05 21:10:11 +03:00
Included linux font directory in truetype
A newbie hack!
This commit is contained in:
parent
6bb3b155d9
commit
b36ffcbe9a
|
@ -235,6 +235,12 @@ def truetype(font=None, size=10, index=0, encoding="", filename=None):
|
|||
if windir:
|
||||
filename = os.path.join(windir, "fonts", font)
|
||||
return FreeTypeFont(filename, size, index, encoding)
|
||||
elif sys.platform == "linux":
|
||||
# check the linux font repository
|
||||
lindir = os.environ.get("XDG_DATA_DIRS")
|
||||
if lindir:
|
||||
filename = os.path.join(lindir, "fonts", font)
|
||||
return FreeTypeFont(filename, size, index, encoding)
|
||||
raise
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user