Make WordPress Core


Ignore:
Timestamp:
06/20/2023 05:26:47 AM (12 months ago)
Author:
isabel_brison
Message:

Editor: use layout.wideSize as max viewport width.

Use the value of layout.wideSize as the maximum viewport width for fluid font size calculations.

Props ramonopoly.

Fixes #58522.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/block-supports/typography.php

    r55133 r55946  
    369369 *
    370370 * @since 6.1.0
     371 * @since 6.3.0 Checks for unsupported min/max viewport values that cause invalid clamp values.
    371372 * @access private
    372373 *
     
    434435    );
    435436
     437    // Protects against unsupported units in min and max viewport widths.
     438    if ( ! $minimum_viewport_width || ! $maximum_viewport_width ) {
     439        return null;
     440    }
     441
    436442    /*
    437443     * Build CSS rule.
     
    455461 * @since 6.1.1 Adjusted rules for min and max font sizes.
    456462 * @since 6.2.0 Added 'settings.typography.fluid.minFontSize' support.
     463 * @since 6.3.0 Using layout.wideSize as max viewport width.
    457464 *
    458465 * @param array $preset                     {
     
    481488
    482489    // Checks if fluid font sizes are activated.
    483     $typography_settings = wp_get_global_settings( array( 'typography' ) );
     490    $global_settings     = wp_get_global_settings();
     491    $typography_settings = isset( $global_settings['typography'] ) ? $global_settings['typography'] : array();
     492    $layout_settings     = isset( $global_settings['layout'] ) ? $global_settings['layout'] : array();
     493
    484494    if (
    485495        isset( $typography_settings['fluid'] ) &&
     
    498508
    499509    // Defaults.
    500     $default_maximum_viewport_width   = '1600px';
     510    $default_maximum_viewport_width   = isset( $layout_settings['wideSize'] ) ? $layout_settings['wideSize'] : '1600px';
    501511    $default_minimum_viewport_width   = '768px';
    502512    $default_minimum_font_size_factor = 0.75;
Note: See TracChangeset for help on using the changeset viewer.