<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[55947] trunk: Editor: use logarithmic scale for fluid typography.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/55947">55947</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/55947","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>isabel_brison</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2023-06-20 07:58:03 +0000 (Tue, 20 Jun 2023)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Editor: use logarithmic scale for fluid typography.

Introduces logarithmic scale factor to calculate a minimum font scale that tapers out as the font size increases.

Props ramonopoly.
Fixes <a href="https://core.trac.wordpress.org/ticket/58523">#58523</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesblocksupportstypographyphp">trunk/src/wp-includes/block-supports/typography.php</a></li>
<li><a href="#trunktestsphpunittestsblocksupportstypographyphp">trunk/tests/phpunit/tests/block-supports/typography.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludesblocksupportstypographyphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/block-supports/typography.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/block-supports/typography.php       2023-06-20 05:26:47 UTC (rev 55946)
+++ trunk/src/wp-includes/block-supports/typography.php 2023-06-20 07:58:03 UTC (rev 55947)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -460,7 +460,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">  * @since 6.1.0
</span><span class="cx" style="display: block; padding: 0 10px">  * @since 6.1.1 Adjusted rules for min and max font sizes.
</span><span class="cx" style="display: block; padding: 0 10px">  * @since 6.2.0 Added 'settings.typography.fluid.minFontSize' support.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @since 6.3.0 Using layout.wideSize as max viewport width.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @since 6.3.0 Using layout.wideSize as max viewport width, and logarithmic scale factor to calculate minimum font scale.
</ins><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="cx" style="display: block; padding: 0 10px">  * @param array $preset                     {
</span><span class="cx" style="display: block; padding: 0 10px">  *     Required. fontSizes preset value as seen in theme.json.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -507,12 +507,14 @@
</span><span class="cx" style="display: block; padding: 0 10px">                : array();
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        // Defaults.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        $default_maximum_viewport_width   = isset( $layout_settings['wideSize'] ) ? $layout_settings['wideSize'] : '1600px';
-       $default_minimum_viewport_width   = '768px';
-       $default_minimum_font_size_factor = 0.75;
-       $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';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $default_maximum_viewport_width       = isset( $layout_settings['wideSize'] ) ? $layout_settings['wideSize'] : '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';
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        // Font sizes.
</span><span class="cx" style="display: block; padding: 0 10px">        $fluid_font_size_settings = isset( $preset['fluid'] ) ? $preset['fluid'] : null;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -567,11 +569,17 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * the given font size multiplied by the min font size scale factor.
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        if ( ! $minimum_font_size_raw ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $calculated_minimum_font_size = round(
-                       $preferred_size['value'] * $default_minimum_font_size_factor,
-                       3
-               );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $preferred_font_size_in_px = 'px' === $preferred_size['unit'] ? $preferred_size['value'] : $preferred_size['value'] * 16;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                /*
+                * The scale factor is a multiplier that affects how quickly the curve will move towards the minimum,
+                * that is, how quickly the size factor reaches 0 given increasing font size values.
+                * For a - b * log2(), lower values of b will make the curve move towards the minimum faster.
+                * The scale factor is constrained between min and max values.
+                */
+               $minimum_font_size_factor     = min( max( 1 - 0.075 * log( $preferred_font_size_in_px, 2 ), $default_minimum_font_size_factor_min ), $default_minimum_font_size_factor_max );
+               $calculated_minimum_font_size = round( $preferred_size['value'] * $minimum_font_size_factor, 3 );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 // Only use calculated min font size if it's > $minimum_font_size_limit value.
</span><span class="cx" style="display: block; padding: 0 10px">                if ( ! empty( $minimum_font_size_limit ) && $calculated_minimum_font_size <= $minimum_font_size_limit['value'] ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        $minimum_font_size_raw = $minimum_font_size_limit['value'] . $minimum_font_size_limit['unit'];
</span></span></pre></div>
<a id="trunktestsphpunittestsblocksupportstypographyphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/block-supports/typography.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/block-supports/typography.php   2023-06-20 05:26:47 UTC (rev 55946)
+++ trunk/tests/phpunit/tests/block-supports/typography.php     2023-06-20 07:58:03 UTC (rev 55947)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -293,6 +293,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * @ticket 56467
</span><span class="cx" style="display: block; padding: 0 10px">         * @ticket 57065
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         * @ticket 58523
</ins><span class="cx" style="display: block; padding: 0 10px">          *
</span><span class="cx" style="display: block; padding: 0 10px">         * @covers ::wp_get_typography_font_size_value
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -385,7 +386,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        'size' => '1.75rem',
</span><span class="cx" style="display: block; padding: 0 10px">                                ),
</span><span class="cx" style="display: block; padding: 0 10px">                                'should_use_fluid_typography' => true,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'expected_output'             => 'clamp(1.313rem, 1.313rem + ((1vw - 0.48rem) * 0.84), 1.75rem)',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'expected_output'             => 'clamp(1.119rem, 1.119rem + ((1vw - 0.2rem) * 0.789), 1.75rem)',
</ins><span class="cx" style="display: block; padding: 0 10px">                         ),
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        'returns clamp value with em min and max units' => array(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -393,15 +394,15 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        'size' => '1.75em',
</span><span class="cx" style="display: block; padding: 0 10px">                                ),
</span><span class="cx" style="display: block; padding: 0 10px">                                'should_use_fluid_typography' => true,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'expected_output'             => 'clamp(1.313em, 1.313rem + ((1vw - 0.48em) * 0.84), 1.75em)',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'expected_output'             => 'clamp(1.119em, 1.119rem + ((1vw - 0.2em) * 0.789), 1.75em)',
</ins><span class="cx" style="display: block; padding: 0 10px">                         ),
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        'returns clamp value for floats'             => array(
</span><span class="cx" style="display: block; padding: 0 10px">                                'font_size'                   => array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        'size' => '100.175px',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 'size' => '70.175px',
</ins><span class="cx" style="display: block; padding: 0 10px">                                 ),
</span><span class="cx" style="display: block; padding: 0 10px">                                'should_use_fluid_typography' => true,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'expected_output'             => 'clamp(75.131px, 4.696rem + ((1vw - 7.68px) * 3.01), 100.175px)',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'expected_output'             => 'clamp(37.897px, 2.369rem + ((1vw - 3.2px) * 2.522), 70.175px)',
</ins><span class="cx" style="display: block; padding: 0 10px">                         ),
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        'coerces integer to `px` and returns clamp value' => array(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -409,15 +410,15 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        'size' => 33,
</span><span class="cx" style="display: block; padding: 0 10px">                                ),
</span><span class="cx" style="display: block; padding: 0 10px">                                'should_use_fluid_typography' => true,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'expected_output'             => 'clamp(24.75px, 1.547rem + ((1vw - 7.68px) * 0.992), 33px)',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'expected_output'             => 'clamp(20.515px, 1.282rem + ((1vw - 3.2px) * 0.975), 33px)',
</ins><span class="cx" style="display: block; padding: 0 10px">                         ),
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        'coerces float to `px` and returns clamp value' => array(
</span><span class="cx" style="display: block; padding: 0 10px">                                'font_size_preset'            => array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        'size' => 100.23,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 'size' => 70.175,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 ),
</span><span class="cx" style="display: block; padding: 0 10px">                                'should_use_fluid_typography' => true,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'expected_output'             => 'clamp(75.173px, 4.698rem + ((1vw - 7.68px) * 3.012), 100.23px)',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'expected_output'             => 'clamp(37.897px, 2.369rem + ((1vw - 3.2px) * 2.522), 70.175px)',
</ins><span class="cx" style="display: block; padding: 0 10px">                         ),
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        'returns clamp value when `fluid` is empty array' => array(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -426,7 +427,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        'fluid' => array(),
</span><span class="cx" style="display: block; padding: 0 10px">                                ),
</span><span class="cx" style="display: block; padding: 0 10px">                                'should_use_fluid_typography' => true,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'expected_output'             => 'clamp(21px, 1.313rem + ((1vw - 7.68px) * 0.841), 28px)',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'expected_output'             => 'clamp(17.905px, 1.119rem + ((1vw - 3.2px) * 0.789), 28px)',
</ins><span class="cx" style="display: block; padding: 0 10px">                         ),
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        'returns clamp value when `fluid` is `null`' => array(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -435,9 +436,33 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        'fluid' => null,
</span><span class="cx" style="display: block; padding: 0 10px">                                ),
</span><span class="cx" style="display: block; padding: 0 10px">                                'should_use_fluid_typography' => true,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'expected_output'             => 'clamp(21px, 1.313rem + ((1vw - 7.68px) * 0.841), 28px)',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'expected_output'             => 'clamp(17.905px, 1.119rem + ((1vw - 3.2px) * 0.789), 28px)',
</ins><span class="cx" style="display: block; padding: 0 10px">                         ),
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        'returns clamp value where min and max fluid values defined' => array(
+                               'font_size'                   => array(
+                                       'size'  => '80px',
+                                       'fluid' => array(
+                                               'min' => '70px',
+                                               'max' => '125px',
+                                       ),
+                               ),
+                               'should_use_fluid_typography' => true,
+                               'expected_output'             => 'clamp(70px, 4.375rem + ((1vw - 3.2px) * 4.297), 125px)',
+                       ),
+
+                       'returns clamp value where max is equal to size' => array(
+                               'font_size'                   => array(
+                                       'size'  => '7.8125rem',
+                                       'fluid' => array(
+                                               'min' => '4.375rem',
+                                               'max' => '7.8125rem',
+                                       ),
+                               ),
+                               'should_use_fluid_typography' => true,
+                               'expected_output'             => 'clamp(4.375rem, 4.375rem + ((1vw - 0.2rem) * 4.298), 7.8125rem)',
+                       ),
+
</ins><span class="cx" style="display: block; padding: 0 10px">                         'returns clamp value if min font size is greater than max' => array(
</span><span class="cx" style="display: block; padding: 0 10px">                                'font_size_preset'            => array(
</span><span class="cx" style="display: block; padding: 0 10px">                                        'size'  => '3rem',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -447,7 +472,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        ),
</span><span class="cx" style="display: block; padding: 0 10px">                                ),
</span><span class="cx" style="display: block; padding: 0 10px">                                'should_use_fluid_typography' => true,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'expected_output'             => 'clamp(5rem, 5rem + ((1vw - 0.48rem) * -5.769), 32px)',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'expected_output'             => 'clamp(5rem, 5rem + ((1vw - 0.2rem) * -3.75), 32px)',
</ins><span class="cx" style="display: block; padding: 0 10px">                         ),
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        'returns value with invalid min/max fluid units' => array(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -487,18 +512,18 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        ),
</span><span class="cx" style="display: block; padding: 0 10px">                                ),
</span><span class="cx" style="display: block; padding: 0 10px">                                'should_use_fluid_typography' => true,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'expected_output'             => 'clamp(20px, 1.25rem + ((1vw - 7.68px) * 93.75), 50rem)',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'expected_output'             => 'clamp(20px, 1.25rem + ((1vw - 3.2px) * 60.938), 50rem)',
</ins><span class="cx" style="display: block; padding: 0 10px">                         ),
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        'returns clamp value where no fluid max size is set' => array(
</span><span class="cx" style="display: block; padding: 0 10px">                                'font_size_preset'            => array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        'size'  => '28px',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 'size'  => '50px',
</ins><span class="cx" style="display: block; padding: 0 10px">                                         'fluid' => array(
</span><span class="cx" style="display: block; padding: 0 10px">                                                'min' => '2.6rem',
</span><span class="cx" style="display: block; padding: 0 10px">                                        ),
</span><span class="cx" style="display: block; padding: 0 10px">                                ),
</span><span class="cx" style="display: block; padding: 0 10px">                                'should_use_fluid_typography' => true,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'expected_output'             => 'clamp(2.6rem, 2.6rem + ((1vw - 0.48rem) * -1.635), 28px)',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'expected_output'             => 'clamp(2.6rem, 2.6rem + ((1vw - 0.2rem) * 0.656), 50px)',
</ins><span class="cx" style="display: block; padding: 0 10px">                         ),
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        'returns clamp value where no fluid min size is set' => array(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -509,7 +534,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        ),
</span><span class="cx" style="display: block; padding: 0 10px">                                ),
</span><span class="cx" style="display: block; padding: 0 10px">                                'should_use_fluid_typography' => true,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'expected_output'             => 'clamp(21px, 1.313rem + ((1vw - 7.68px) * 7.091), 80px)',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'expected_output'             => 'clamp(17.905px, 1.119rem + ((1vw - 3.2px) * 4.851), 80px)',
</ins><span class="cx" style="display: block; padding: 0 10px">                         ),
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        'should not apply lower bound test when fluid values are set' => array(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -521,7 +546,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        ),
</span><span class="cx" style="display: block; padding: 0 10px">                                ),
</span><span class="cx" style="display: block; padding: 0 10px">                                'should_use_fluid_typography' => true,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'expected_output'             => 'clamp(0.5rem, 0.5rem + ((1vw - 0.48rem) * 8.654), 5rem)',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'expected_output'             => 'clamp(0.5rem, 0.5rem + ((1vw - 0.2rem) * 5.625), 5rem)',
</ins><span class="cx" style="display: block; padding: 0 10px">                         ),
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        'should not apply lower bound test when only fluid min is set' => array(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -532,7 +557,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        ),
</span><span class="cx" style="display: block; padding: 0 10px">                                ),
</span><span class="cx" style="display: block; padding: 0 10px">                                'should_use_fluid_typography' => true,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'expected_output'             => 'clamp(12px, 0.75rem + ((1vw - 7.68px) * 0.962), 20px)',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'expected_output'             => 'clamp(12px, 0.75rem + ((1vw - 3.2px) * 0.625), 20px)',
</ins><span class="cx" style="display: block; padding: 0 10px">                         ),
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        'should not apply lower bound test when only fluid max is set' => array(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -543,7 +568,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        ),
</span><span class="cx" style="display: block; padding: 0 10px">                                ),
</span><span class="cx" style="display: block; padding: 0 10px">                                'should_use_fluid_typography' => true,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'expected_output'             => 'clamp(0.875rem, 0.875rem + ((1vw - 0.48rem) * 36.779), 20rem)',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'expected_output'             => 'clamp(0.875rem, 0.875rem + ((1vw - 0.2rem) * 23.906), 20rem)',
</ins><span class="cx" style="display: block; padding: 0 10px">                         ),
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        'returns clamp value when min and max font sizes are equal' => array(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -555,8 +580,35 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        ),
</span><span class="cx" style="display: block; padding: 0 10px">                                ),
</span><span class="cx" style="display: block; padding: 0 10px">                                'should_use_fluid_typography' => true,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'expected_output'             => 'clamp(30px, 1.875rem + ((1vw - 7.68px) * 1), 30px)',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'expected_output'             => 'clamp(30px, 1.875rem + ((1vw - 3.2px) * 1), 30px)',
</ins><span class="cx" style="display: block; padding: 0 10px">                         ),
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+                       'should apply scaled min font size for em values when custom min font size is not set' => array(
+                               'font_size'                   => array(
+                                       'size' => '12rem',
+                               ),
+                               'should_use_fluid_typography' => true,
+                               'expected_output'             => 'clamp(5.174rem, 5.174rem + ((1vw - 0.2rem) * 8.533), 12rem)',
+                       ),
+
+                       'should apply scaled min font size for px values when custom min font size is not set' => array(
+                               'font_size'                   => array(
+                                       'size' => '200px',
+                               ),
+                               'should_use_fluid_typography' => true,
+                               'expected_output'             => 'clamp(85.342px, 5.334rem + ((1vw - 3.2px) * 8.958), 200px)',
+                       ),
+
+                       'should not apply scaled min font size for minimum font size when custom min font size is set' => array(
+                               'font_size'                   => array(
+                                       'size'  => '200px',
+                                       'fluid' => array(
+                                               'min' => '100px',
+                                       ),
+                               ),
+                               'should_use_fluid_typography' => true,
+                               'expected_output'             => 'clamp(100px, 6.25rem + ((1vw - 3.2px) * 7.813), 200px)',
+                       ),
</ins><span class="cx" style="display: block; padding: 0 10px">                 );
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -569,6 +621,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * @ticket 57065
</span><span class="cx" style="display: block; padding: 0 10px">         * @ticket 57529
</span><span class="cx" style="display: block; padding: 0 10px">         * @ticket 58522
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         * @ticket 58523
</ins><span class="cx" style="display: block; padding: 0 10px">          *
</span><span class="cx" style="display: block; padding: 0 10px">         * @covers ::wp_register_typography_support
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -629,7 +682,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        'returns clamp value using default config' => array(
</span><span class="cx" style="display: block; padding: 0 10px">                                'font_size_value' => '15px',
</span><span class="cx" style="display: block; padding: 0 10px">                                'theme_slug'      => 'block-theme-child-with-fluid-typography',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'expected_output' => 'font-size:clamp(14px, 0.875rem + ((1vw - 7.68px) * 0.12), 15px);',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'expected_output' => 'font-size:clamp(14px, 0.875rem + ((1vw - 3.2px) * 0.078), 15px);',
</ins><span class="cx" style="display: block; padding: 0 10px">                         ),
</span><span class="cx" style="display: block; padding: 0 10px">                        'returns value when font size <= default min font size bound' => array(
</span><span class="cx" style="display: block; padding: 0 10px">                                'font_size_value' => '13px',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -639,7 +692,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        'returns clamp value using custom fluid config' => array(
</span><span class="cx" style="display: block; padding: 0 10px">                                'font_size_value' => '17px',
</span><span class="cx" style="display: block; padding: 0 10px">                                'theme_slug'      => 'block-theme-child-with-fluid-typography-config',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'expected_output' => 'font-size:clamp(16px, 1rem + ((1vw - 7.68px) * 0.431), 17px);',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'expected_output' => 'font-size:clamp(16px, 1rem + ((1vw - 3.2px) * 0.147), 17px);',
</ins><span class="cx" style="display: block; padding: 0 10px">                         ),
</span><span class="cx" style="display: block; padding: 0 10px">                        'returns value when font size <= custom min font size bound' => array(
</span><span class="cx" style="display: block; padding: 0 10px">                                'font_size_value' => '15px',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -656,6 +709,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * @ticket 56467
</span><span class="cx" style="display: block; padding: 0 10px">         * @ticket 57065
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         * @ticket 58523
</ins><span class="cx" style="display: block; padding: 0 10px">          *
</span><span class="cx" style="display: block; padding: 0 10px">         * @dataProvider data_generate_replace_inline_font_styles_with_fluid_values_fixtures
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -703,7 +757,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                'block_content'               => '<h2 class="has-vivid-red-background-color has-background has-link-color" style="margin-top:var(--wp--preset--spacing--60);font-size:4rem;font-style:normal;font-weight:600;letter-spacing:29px;text-decoration:underline;text-transform:capitalize">This is a heading</h2>',
</span><span class="cx" style="display: block; padding: 0 10px">                                'font_size_value'             => '4rem',
</span><span class="cx" style="display: block; padding: 0 10px">                                'should_use_fluid_typography' => true,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'expected_output'             => '<h2 class="has-vivid-red-background-color has-background has-link-color" style="margin-top:var(--wp--preset--spacing--60);font-size:clamp(3rem, 3rem + ((1vw - 0.48rem) * 1.923), 4rem);font-style:normal;font-weight:600;letter-spacing:29px;text-decoration:underline;text-transform:capitalize">This is a heading</h2>',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'expected_output'             => '<h2 class="has-vivid-red-background-color has-background has-link-color" style="margin-top:var(--wp--preset--spacing--60);font-size:clamp(2.2rem, 2.2rem + ((1vw - 0.2rem) * 2.25), 4rem);font-style:normal;font-weight:600;letter-spacing:29px;text-decoration:underline;text-transform:capitalize">This is a heading</h2>',
</ins><span class="cx" style="display: block; padding: 0 10px">                         ),
</span><span class="cx" style="display: block; padding: 0 10px">                        'return_content_if_no_inline_font_size_found'  => array(
</span><span class="cx" style="display: block; padding: 0 10px">                                'block_content'               => '<p class="has-medium-font-size" style="font-style:normal;font-weight:600;letter-spacing:29px;">A paragraph inside a group</p>',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -721,13 +775,13 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                'block_content'               => '<p class="has-medium-font-size" style="    font-size:   20px   ;    ">A paragraph inside a group</p>',
</span><span class="cx" style="display: block; padding: 0 10px">                                'font_size_value'             => '20px',
</span><span class="cx" style="display: block; padding: 0 10px">                                'should_use_fluid_typography' => true,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'expected_output'             => '<p class="has-medium-font-size" style="    font-size:clamp(15px, 0.938rem + ((1vw - 7.68px) * 0.601), 20px);    ">A paragraph inside a group</p>',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'expected_output'             => '<p class="has-medium-font-size" style="    font-size:clamp(14px, 0.875rem + ((1vw - 3.2px) * 0.469), 20px);    ">A paragraph inside a group</p>',
</ins><span class="cx" style="display: block; padding: 0 10px">                         ),
</span><span class="cx" style="display: block; padding: 0 10px">                        'return_content_with_first_match_replace_only' => array(
</span><span class="cx" style="display: block; padding: 0 10px">                                'block_content'               => "<div class=\"wp-block-group\" style=\"font-size:1.5em\"> \n \n<p style=\"font-size:1.5em\">A paragraph inside a group</p></div>",
</span><span class="cx" style="display: block; padding: 0 10px">                                'font_size_value'             => '1.5em',
</span><span class="cx" style="display: block; padding: 0 10px">                                'should_use_fluid_typography' => true,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'expected_output'             => "<div class=\"wp-block-group\" style=\"font-size:clamp(1.125em, 1.125rem + ((1vw - 0.48em) * 0.721), 1.5em);\"> \n \n<p style=\"font-size:1.5em\">A paragraph inside a group</p></div>",
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'expected_output'             => "<div class=\"wp-block-group\" style=\"font-size:clamp(0.984em, 0.984rem + ((1vw - 0.2em) * 0.645), 1.5em);\"> \n \n<p style=\"font-size:1.5em\">A paragraph inside a group</p></div>",
</ins><span class="cx" style="display: block; padding: 0 10px">                         ),
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span></span></pre>
</div>
</div>

</body>
</html>