I'm working with WP_Theme_JSON class. I feed it with a decode theme.json and use to generate styles I want to use in a custom editor.
The issue is that even though I specify set settings.typography.fluid to false and provide values in pixels the styles generated by WP_Theme_JSON::get_stylesheet still contain the values converted to clamp function.
This seems to happen because wp_get_typography_font_size_valuechecks the global settings to see if the fluid font size is enabled. So if the site is configured to use the fluid font size it is always applied no matter what value I configure in data I pass to WP_Theme_JSON.
To add more context, my use case is a custom Gutenberg email editor, and I want to disable the fluid font size because clamp is not supported in many email clients.
Step-by-step reproduction instructions
1) I have a WP site running on v 6.4, and I use The Twenty-Three theme.
2) I use the following code snippet
Description
I'm working with
WP_Theme_JSON
class. I feed it with a decode theme.json and use to generate styles I want to use in a custom editor. The issue is that even though I specify setsettings.typography.fluid
tofalse
and provide values in pixels the styles generated byWP_Theme_JSON::get_stylesheet
still contain the values converted toclamp
function.This seems to happen because
wp_get_typography_font_size_value
checks the global settings to see if the fluid font size is enabled. So if the site is configured to use the fluid font size it is always applied no matter what value I configure in data I pass toWP_Theme_JSON
.To add more context, my use case is a custom Gutenberg email editor, and I want to disable the fluid font size because
clamp
is not supported in many email clients.Step-by-step reproduction instructions
1) I have a WP site running on v 6.4, and I use The Twenty-Three theme. 2) I use the following code snippet
h1{font-size: clamp(27.894px, 1.743rem + ((1vw - 3.2px) * 2.285), 48px);}
but I would expecth1{font-size: 48px;}
Screenshots, screen recording, code snippet
No response
Environment info
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes