Make WordPress Core

Opened 15 years ago

Closed 11 years ago

#11727 closed enhancement (wontfix)

Tag cloud widget - font size

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

Description

Hi

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
15 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
15 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
15 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
15 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
15 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
15 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
14 years ago

Related #14577

#8 @iseulde
11 years ago

  • Component changed from General to Widgets

#9 @helen
11 years ago

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

Given:

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

Closing.

Note: See TracTickets for help on using tickets.