You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Overlapping text in image (maybe just with certain fonts) in SVG export. (Also, incidentally, the font embed doesn't seem to actually embed the font when opened on a different computer, but I guess I'll file another bug for that eventually.)
Steps/Code to Reproduce
The code for generation itself is pretty standard, except for adding the text outline (but that's not what's causing this issue); it's part of a larger function:
wc = wordcloud.WordCloud(width=400,height=400,collocations=False, background_color='white', font_path=font_path, color_func=color_func).generate(text_string)
light_colors = [yellow,cream,lavender,beige,grey,gray]
wc_svg = wc.to_svg(embed_font=True)
if colors==None or (len(colors) == 1 and colors[0] in light_colors):
wc_svg = re.sub('style="', 'style="stroke:#000000; paint-order:stroke; stroke-width:0.2; ', wc_svg)
else:
for color in light_colors:
wc_svg = re.sub(f'style="fill:{color}', f'style="fill:{color}; stroke:#000000; paint-order:stroke; stroke-width:0.2;', wc_svg)
# Save to SVG, if a path was specified.
if svg_path is not None:
with open(svg_path, 'w', encoding='utf-8') as svg_file:
svg_file.write(wc_svg)
I haven't included the text string because I generate it as part of the function, but if you think it's really necessary, I can supply it.
The font that I've encountered problems with is Bembo. (I tried to attach it, but Github says it doesn't support that file type. If you need it, I can host it and put a link.) I haven't checked every other font that I'm using, but the ones I've looked at don't cause any issues.
Expected Results
The text shouldn't overlap, regardless of what the font is.
Actual Results
See below. The text of the SVG is below the two images.
Description
Overlapping text in image (maybe just with certain fonts) in SVG export. (Also, incidentally, the font embed doesn't seem to actually embed the font when opened on a different computer, but I guess I'll file another bug for that eventually.)
Steps/Code to Reproduce
The code for generation itself is pretty standard, except for adding the text outline (but that's not what's causing this issue); it's part of a larger function:
I haven't included the text string because I generate it as part of the function, but if you think it's really necessary, I can supply it.
The font that I've encountered problems with is Bembo. (I tried to attach it, but Github says it doesn't support that file type. If you need it, I can host it and put a link.) I haven't checked every other font that I'm using, but the ones I've looked at don't cause any issues.
Expected Results
The text shouldn't overlap, regardless of what the font is.
Actual Results
See below. The text of the SVG is below the two images.
Non-overlapping matplotlib image:
Overlapping SVG export (as PNG):
Versions
Windows-10-10.0.19045-SP0
Python 3.11.0 (main, Oct 24 2022, 18:26:48) [MSC v.1933 64 bit (AMD64)]
NumPy 1.26.1
matplotlib 3.8.1
wordcloud 1.9.2
The text was updated successfully, but these errors were encountered: