WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 2 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:

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)

comment:1 @nacin6 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.

comment:2 @tin686 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 ) ) )

comment:3 @nacin6 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.

comment:4 @tin686 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.

comment:5 @nacin6 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.

comment:6 @nacin5 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

comment:7 @nacin5 years ago

Related #14577

comment:8 @iseulde2 years ago

  • Component changed from General to Widgets

comment:9 @helen2 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.