Make WordPress Core

Opened 20 months ago

Closed 20 months ago

Last modified 20 months ago

#57529 closed enhancement (fixed)

Adds fluid typography minimum font size settings to wp_get_typography_font_size_value()

Reported by: andrewserong's profile andrewserong Owned by: hellofromtonya's profile hellofromTonya
Milestone: 6.2 Priority: normal
Severity: normal Version:
Component: Editor Keywords: has-patch has-unit-tests gutenberg-merge commit
Focuses: Cc:

Description

In https://github.com/WordPress/gutenberg/pull/42489 a feature was added to fluid typography in theme.json that allows a theme to specify a minimum font size to be used in fluid typography calculated font-size rules. The provided value ensures the fluid typography rules do not go below the settings.typography.fluid.minFontSize value. For example, if this is set to 16px then any font-sizes used at 16px or less will be output as-is without fluid typography rules being applied.

This feature is expected to land as part of WordPress 6.2, so it would be good to ensure that the PHP changes are backported in time for the release.

Change History (10)

This ticket was mentioned in PR #3866 on WordPress/wordpress-develop by @andrewserong.


20 months ago
#1

  • Keywords has-patch has-unit-tests added

This PR backports the PHP changes in this Gutenberg PR: https://github.com/WordPress/gutenberg/pull/42489

The feature adds a settings.typography.fluid.minFontSize property to theme.json which allows themes to set a minimum font size for fluid typography calculations.

### Testing instructions

To test: edit the TT3 theme's theme.json file to swap out settings.typography.fluid from its current boolean value tor an object that specifies a minimum font size. For example, the following sets the minimum font size to 15px:

			"fluid": {
				"minFontSize": "15px"
			},

Then, in a post, create a few paragraphs and set a variety of custom font sizes. In the below screenshot of the markup, there are three paragraph blocks, set to 15px, 16px, and 20px respectively. Notice how the first block does not have fluid rules applied, and for the second and third blocks, the minimum size is 15px:

https://i0.wp.com/user-images.githubusercontent.com/14988353/213966207-17a887a4-2159-40e9-a561-9113e1eb0ee3.png

Note: this PR backports the PHP changes only. The update to support this feature within the block editor will be backported as part of the usual JS packages update. It should be pretty safe to land this PHP change first.

Trac ticket: https://core.trac.wordpress.org/ticket/57529

#2 @hellofromTonya
20 months ago

  • Component changed from General to Editor
  • Keywords gutenberg-merge added
  • Milestone changed from Awaiting Review to 6.2
  • Version trunk deleted

@hellofromTonya commented on PR #3866:


20 months ago
#4

Confirmed the PR does backport the PHP changes from Gutenberg's /lib/block-supports/typography.php from Gutenberg's PR 42489

Note: The JavaScript changes will be handled when the packages are updated.

@hellofromTonya commented on PR #3866:


20 months ago
#5

Confirmed the PR does backport the PHP changes from Gutenberg's /lib/block-supports/typography.php from Gutenberg's PR 42489

Note: The JavaScript changes will be handled when the packages are updated.

#6 @hellofromTonya
20 months ago

  • Keywords commit added
  • Owner set to hellofromTonya
  • Status changed from new to reviewing

As noted in the PR's approval, the PR does include all of the relevant PHP additions/changes from Gutenberg PR 42489. It includes integration tests.

Marking for commit. Self-assigning for the commit.

#7 @hellofromTonya
20 months ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 55133:

Editor: Adds 'settings.typography.fluid.minFontSize' support to wp_get_typography_font_size_value().

In wp_get_typography_font_size_value(), adds support for using a minimum font size for fluid typography when defined in a theme's theme.json file.

Reference:

Follow-up to [54497], [54260].

Props andrewserong, ramonopoly, hellofromTonya, joen.
Fixes #57529.

#9 @hellofromTonya
20 months ago

  • Summary changed from Backport fluid typography minimum font size settings from Gutenberg to Adds fluid typography minimum font size settings to wp_get_typography_font_size_value()

@andrewserong commented on PR #3866:


20 months ago
#10

Wonderful, thank you for landing this one, Tonya! 🙇

Note: See TracTickets for help on using tickets.