Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
keeleliin
word_cloud_est
Commits
570717fe
Commit
570717fe
authored
Jun 19, 2015
by
Andreas Mueller
Browse files
Merge pull request #78 from amueller/local_font
Include a droid sans mono ttf file
parents
c990bc9e
18c4a651
Changes
4
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
570717fe
...
...
@@ -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.
setup.py
View file @
570717fe
...
...
@@ -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'
]}
)
wordcloud/DroidSansMono.ttf
0 → 100644
View file @
570717fe
File added
wordcloud/wordcloud.py
View file @
570717fe
...
...
@@ -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
'
)])
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment