timdream / wordcloud2.js

Tag cloud/Wordle presentation on 2D canvas or HTML
https://wordcloud2-js.timdream.org/
MIT License
2.34k stars 510 forks source link

Word wrap #179

Open virilo opened 3 years ago

virilo commented 3 years ago

Would it be possible to activate a word wrap break-down in order to insert a newline between words, when the tag label is using more area than the canvas width?

So, instead of shrinking the label "Indians of North America", break the text in two lines: "Indians of North America"

Thanks in advance

virilo commented 3 years ago

I tried to force this behavior by introducing a \n or a <br/> but neither of them worked.

Offbeatmammal commented 3 months ago

this is something that would be very interesting. would be great if the lines could each have their own formatting, as for my specific usecase I'd want the second line to have a max font size that's smaller than the first line as it's just some supplemental text (specifically Country Name would be the first line and population size as the second)