# HG changeset patch # User Josef 'Jeff' Sipek # Date 1598585468 0 # Fri Aug 28 03:31:08 2020 +0000 # Node ID b8d7683ec05a4646c97c5743bb962edd6e587132 # Parent fd4337f68e43a67377328911bc855469758da96a 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 diff --git a/sidebar.c b/sidebar.c --- a/sidebar.c +++ b/sidebar.c @@ -45,11 +45,10 @@ 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)