Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
keeleliin
word_cloud_est
Commits
0b0e8809
Commit
0b0e8809
authored
Jan 26, 2016
by
Raphael Boidol
Browse files
ensure the scale parameter will be used to calculate integer positions for words
parent
89508af2
Changes
1
Hide whitespace changes
Inline
Side-by-side
wordcloud/wordcloud.py
View file @
0b0e8809
...
@@ -460,14 +460,14 @@ class WordCloud(object):
...
@@ -460,14 +460,14 @@ class WordCloud(object):
else
:
else
:
height
,
width
=
self
.
height
,
self
.
width
height
,
width
=
self
.
height
,
self
.
width
img
=
Image
.
new
(
self
.
mode
,
(
width
*
self
.
scale
,
height
*
self
.
scale
),
img
=
Image
.
new
(
self
.
mode
,
(
int
(
width
*
self
.
scale
)
,
int
(
height
*
self
.
scale
)
)
,
self
.
background_color
)
self
.
background_color
)
draw
=
ImageDraw
.
Draw
(
img
)
draw
=
ImageDraw
.
Draw
(
img
)
for
(
word
,
count
),
font_size
,
position
,
orientation
,
color
in
self
.
layout_
:
for
(
word
,
count
),
font_size
,
position
,
orientation
,
color
in
self
.
layout_
:
font
=
ImageFont
.
truetype
(
self
.
font_path
,
font_size
*
self
.
scale
)
font
=
ImageFont
.
truetype
(
self
.
font_path
,
int
(
font_size
*
self
.
scale
)
)
transposed_font
=
ImageFont
.
TransposedFont
(
font
,
transposed_font
=
ImageFont
.
TransposedFont
(
font
,
orientation
=
orientation
)
orientation
=
orientation
)
pos
=
(
position
[
1
]
*
self
.
scale
,
position
[
0
]
*
self
.
scale
)
pos
=
(
int
(
position
[
1
]
*
self
.
scale
)
,
int
(
position
[
0
]
*
self
.
scale
)
)
draw
.
text
(
pos
,
word
,
fill
=
color
,
font
=
transposed_font
)
draw
.
text
(
pos
,
word
,
fill
=
color
,
font
=
transposed_font
)
return
img
return
img
...
...
Write
Preview
Supports
Markdown
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