isaackd / wcloud

Create word clouds
MIT License
25 stars 7 forks source link

SVG cloud word. #14

Open eufelipemateus opened 8 months ago

eufelipemateus commented 8 months ago

This lib generate SVG cloud word?

isaackd commented 6 months ago

At the moment it only outputs to a PNG file, but in theory it wouldn't be hard to modify it to support SVG. https://github.com/isaackd/wcloud/blob/21aee448f98a1c4de5e4a11ccb6154daeb35c57d/src/lib.rs#L133-L168 This function could be changed to place the words in an SVG file since all the necessary data is there: word, font size, x, y.

eufelipemateus commented 6 months ago

Cool! i am starting change here will try make this feature. Still not working yet

https://github.com/eufelipemateus/wcloud/commit/baf0f7aaba25ee64d0bf736d24bcd762ff320c57

isaackd commented 6 months ago

Looks good! Excited to try it out.

isaackd commented 5 months ago

image

I checked out your branch and was able to modify it to get an SVG word cloud. Everything is slightly off because of the rendering differences between theab_glyph library used for calculating word positions and SVG though. Let me know if you're interested in trying to take this further and I can make a PR on your repo with the code.

extrawurst commented 4 months ago

This feature would be dope! have not found any other wordcloud implementation supporting svg

eufelipemateus commented 4 months ago

image

I checked out your branch and was able to modify it to get an SVG word cloud. Everything is slightly off because of the rendering differences between theab_glyph library used for calculating word positions and SVG though. Let me know if you're interested in trying to take this further and I can make a PR on your repo with the code.

Hello @isaackd Yes, I am interested in help. If you can do the PR to fix it I'll be happy. I can generate the svg but I still can't create the cloud itself.

eufelipemateus commented 4 months ago

At the moment it only outputs to a PNG file, but in theory it wouldn't be hard to modify it to support SVG.

https://github.com/isaackd/wcloud/blob/21aee448f98a1c4de5e4a11ccb6154daeb35c57d/src/lib.rs#L133-L168

This function could be changed to place the words in an SVG file since all the necessary data is there: word, font size, x, y.

Yes, I couldn't generate the svg, now I can't create the cloud. I want to create another function to allow me to generate only svg and keep the png generation function as it is today.