sidebar: use a logarithmic tagcloud scaling Instead of linearly scaling the tagcloud entries based on their counts, scale it based on the 2 times the natural log of the count. This gives more weight to lower count tags, making the whole cloud looking "denser". Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
1 files changed, 3 insertions(+), 4 deletions(-) M sidebar.c
M sidebar.c +3 -4
@@ 45,11 45,10 @@ static int __tag_size(int count, int cmi if (count <= cmin) return config.tagcloud_min_size; - size = (config.tagcloud_max_size - config.tagcloud_min_size) * - (count - cmin); - size /= (float) (cmax - cmin); + size = 2 * log(count - cmin); - return ceil(config.tagcloud_min_size + size); + return MIN(ceil(config.tagcloud_min_size + size), + config.tagcloud_max_size); } static int __tagcloud_init(void *arg, unsigned long ntags)