Skip to content

Commit

Permalink
Merge pull request amueller#78 from amueller/local_font
Browse files Browse the repository at this point in the history
Include a droid sans mono ttf file
  • Loading branch information
amueller committed Jun 19, 2015
2 parents c990bc9 + 18c4a65 commit 570717f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,7 @@ not iterable` problem][intprob] also showcased on the blog.
[imgur-wordnuvola]: http://defacto133.imgur.com/all/
[intprob]: http://peekaboo-vision.blogspot.de/2012/11/a-wordcloud-in-python.html#bc_0_28B


## Licensing
The wordcloud library is MIT licenced, but contains DroidSansMono.ttf, a true type font by Google, that is apache licensed.
The font is by no means integral, and any other font can be used by setting the ``font_path`` variable when creating a ``WordCloud`` object.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
ext_modules=[Extension("wordcloud/query_integral_image",
["wordcloud/query_integral_image.c"])],
packages=['wordcloud'],
package_data={'wordcloud': ['stopwords']}
package_data={'wordcloud': ['stopwords', 'DroidSansMono.ttf']}
)
Binary file added wordcloud/DroidSansMono.ttf
Binary file not shown.
6 changes: 1 addition & 5 deletions wordcloud/wordcloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import sys
import numpy as np
from operator import itemgetter
from platform import system

from PIL import Image
from PIL import ImageDraw
Expand All @@ -22,10 +21,7 @@

item1 = itemgetter(1)

if system() == "Windows":
FONT_PATH = r"C:\Windows\Fonts\consola.ttf"
else:
FONT_PATH = os.environ.get("FONT_PATH", "/usr/share/fonts/truetype/droid/DroidSansMono.ttf")
FONT_PATH = os.environ.get("FONT_PATH", os.path.join(os.path.dirname(__file__), "DroidSansMono.ttf"))
STOPWORDS = set([x.strip() for x in open(os.path.join(os.path.dirname(__file__),
'stopwords')).read().split('\n')])

Expand Down

0 comments on commit 570717f

Please sign in to comment.