Make WordPress Core

Opened 8 years ago

Closed 5 years ago

#11727 closed enhancement (wontfix)

Tag cloud widget - font size

Reported by: tin68 Owned by: nacin
Milestone: Priority: normal
Severity: normal Version: 2.9.1
Component: Widgets Keywords:
Focuses: Cc:



Not really a bug - but more a question.

The tag cloud widget displays the tags with different font sizes - this works correctly on my blog.

But I don't understand and I think it doesn't make sense to set the font-size with a decimal number:

eg. of HTML code

style='font-size: 9.3582089552239pt;'

An integer value of 8 to 22 should be correct in my opinion.

Change History (9)

#1 @nacin
8 years ago

A little rounding wouldn't be a bad idea, but a float is valid here. wp_tag_cloud() can accept a smallest value, largest value, and a unit. Browsers do use or even rely on floats for some units, take em for example.

#2 @tin68
8 years ago

But tag cloud is using not "em" but "pt".

Open Source project are great ;-) I made now a little patch to category-template.php file, line 684 is changed now to:

   ( round( $smallest + ( ( $count - $min_count ) * $font_step ) ) )

#3 @nacin
8 years ago

The tag cloud widget uses wp_tag_cloud() with default args (with the 'widget_tag_cloud_args' filter applied). But wp_generate_tag_cloud() can accept a unit.

While I perhaps see the case for rounding, round() creates an integer unless you include a precision argument.

Honestly, I'm not sure it is necessary. Maybe with a precision of at least 4.

#4 @tin68
8 years ago

Sorry, which browser can display the difference of font-size 9.4545 and 9.4546 ? No - precision of 4 is useless. Perhaps precision 1 makes sense - then to browser an round it up or down.

#5 @nacin
8 years ago

9.4545 might be displayed differently than 9.4546 due to screen resolutions and how the pixels fall.

That's not the point I was trying to make though. The point is that we can't round it to 0 or 1, as the unit may rely heavily on decimals, such as em.

#6 @nacin
8 years ago

  • Milestone changed from Unassigned to Future Release
  • Owner set to nacin
  • Status changed from new to reviewing
  • Type changed from defect (bug) to enhancement

#7 @nacin
8 years ago

Related #14577

#8 @iseulde
5 years ago

  • Component changed from General to Widgets

#9 @helen
5 years ago

  • Keywords widget tag cloud removed
  • Milestone Future Release deleted
  • Resolution set to wontfix
  • Status changed from reviewing to closed


The point is that we can't round it to 0 or 1, as the unit may rely heavily on decimals, such as em.


Note: See TracTickets for help on using tickets.