What is the formula to calculate the font-size for tags in a tagcloud?

Viewed 6274

I have a tag cloud and I need to know how can I change the font-size for the most used tags.

I need to set a min-font-size and a max-font-size.

5 Answers

I came up with this:

max_word_count = 412  # should count from list
min_word_count = 44   # should count from list
difference = max_word_count - min_word_count
min_weight = 99 / difference * min_word_count

for each tag
    weight = 99 / difference * this_word_count - min_weight + 1

Which gave me weighed words between 1 and 100. It works perfectly for me at znaci.net/arhiv.

DISCLAIMER: I am not good at math.

Related