Commit 570717fe authored by Andreas Mueller's avatar Andreas Mueller

Merge pull request #78 from amueller/local_font

Include a droid sans mono ttf file
parents c990bc9e 18c4a651
......@@ -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.
......@@ -10,5 +10,5 @@ setup(
ext_modules=[Extension("wordcloud/query_integral_image",
["wordcloud/query_integral_image.c"])],
packages=['wordcloud'],
package_data={'wordcloud': ['stopwords']}
package_data={'wordcloud': ['stopwords', 'DroidSansMono.ttf']}
)
......@@ -12,7 +12,6 @@ import re
import sys
import numpy as np
from operator import itemgetter
from platform import system
from PIL import Image
from PIL import ImageDraw
......@@ -22,10 +21,7 @@ from .query_integral_image import query_integral_image
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')])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment