diff --git a/wp-includes/block-supports/typography.php b/wp-includes/block-supports/typography.php index 34345ca4ec..b31464c12d 100644 --- a/wp-includes/block-supports/typography.php +++ b/wp-includes/block-supports/typography.php @@ -471,6 +471,7 @@ function wp_get_computed_fluid_typography_value( $args = array() ) { * @since 6.1.1 Adjusted rules for min and max font sizes. * @since 6.2.0 Added 'settings.typography.fluid.minFontSize' support. * @since 6.3.0 Using layout.wideSize as max viewport width, and logarithmic scale factor to calculate minimum font scale. + * @since 6.4.0 Added configurable min and max viewport width values to the typography.fluid theme.json schema. * * @param array $preset { * Required. fontSizes preset value as seen in theme.json. @@ -517,14 +518,21 @@ function wp_get_typography_font_size_value( $preset, $should_use_fluid_typograph : array(); // Defaults. - $default_maximum_viewport_width = isset( $layout_settings['wideSize'] ) && ! empty( wp_get_typography_value_and_unit( $layout_settings['wideSize'] ) ) ? $layout_settings['wideSize'] : '1600px'; + $default_maximum_viewport_width = '1600px'; $default_minimum_viewport_width = '320px'; $default_minimum_font_size_factor_max = 0.75; $default_minimum_font_size_factor_min = 0.25; $default_scale_factor = 1; - $has_min_font_size = isset( $fluid_settings['minFontSize'] ) && - ! empty( wp_get_typography_value_and_unit( $fluid_settings['minFontSize'] ) ); - $default_minimum_font_size_limit = $has_min_font_size ? $fluid_settings['minFontSize'] : '14px'; + $default_minimum_font_size_limit = '14px'; + + // Defaults overrides. + $minimum_viewport_width = isset( $fluid_settings['minViewportWidth'] ) ? $fluid_settings['minViewportWidth'] : $default_minimum_viewport_width; + $maximum_viewport_width = isset( $layout_settings['wideSize'] ) && ! empty( wp_get_typography_value_and_unit( $layout_settings['wideSize'] ) ) ? $layout_settings['wideSize'] : $default_maximum_viewport_width; + if ( isset( $fluid_settings['maxViewportWidth'] ) ) { + $maximum_viewport_width = $fluid_settings['maxViewportWidth']; + } + $has_min_font_size = isset( $fluid_settings['minFontSize'] ) && ! empty( wp_get_typography_value_and_unit( $fluid_settings['minFontSize'] ) ); + $minimum_font_size_limit = $has_min_font_size ? $fluid_settings['minFontSize'] : $default_minimum_font_size_limit; // Font sizes. $fluid_font_size_settings = isset( $preset['fluid'] ) ? $preset['fluid'] : null; @@ -551,7 +559,7 @@ function wp_get_typography_font_size_value( $preset, $should_use_fluid_typograph * in order to perform comparative checks. */ $minimum_font_size_limit = wp_get_typography_value_and_unit( - $default_minimum_font_size_limit, + $minimum_font_size_limit, array( 'coerce_to' => $preferred_size['unit'], ) @@ -600,8 +608,8 @@ function wp_get_typography_font_size_value( $preset, $should_use_fluid_typograph $fluid_font_size_value = wp_get_computed_fluid_typography_value( array( - 'minimum_viewport_width' => $default_minimum_viewport_width, - 'maximum_viewport_width' => $default_maximum_viewport_width, + 'minimum_viewport_width' => $minimum_viewport_width, + 'maximum_viewport_width' => $maximum_viewport_width, 'minimum_font_size' => $minimum_font_size_raw, 'maximum_font_size' => $maximum_font_size_raw, 'scale_factor' => $default_scale_factor, diff --git a/wp-includes/version.php b/wp-includes/version.php index 56ef5085ed..3e8a5a1287 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.4-alpha-56534'; +$wp_version = '6.4-alpha-56535'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.