Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional/custom length units for font sizes #54138

Closed
gungfujoe opened this issue Sep 3, 2023 · 1 comment
Closed

Additional/custom length units for font sizes #54138

gungfujoe opened this issue Sep 3, 2023 · 1 comment

Comments

@gungfujoe
Copy link

What problem does this address?

Custom font sizes currently can only be specified in terms of pix, em, or rem. In some cases, it makes most sense for fonts to scale with the screen (vh, vw, vmin, and vmax units). This is implicitly recognized by the "fluid" font sizes allowed in the non-custom font sizes within themes.json. and some editors might, for reasons of their own, prefer to use other font size types (ex, percentage, lh, rlh, and so on). Currently, there appears to be no way to do this, except with custom CSS. See my WordPress.org forum post on the topic for a little bit of additional discussion.

What is your proposed solution?

Currently, the theme.json file supports a "spacing" section, with a subsection of "units." This allows me to add any units I'd like to the theme editor for custom sizing of many objects (which I've tested successfully by adding vmin and vmax), but fonts do not honor this. A similar construct should be added into the "typography" section. Presently, "customFontSize" is only a boolean, but there needs to be some sort of "units" option that can be applied to those custom font sizes. My recommendation is to simply add a "units" section that only applies when "customFontSize" is true. That seems simpler than making "customFontSize" a container for more variables, thereby breaking compatibility with the current schema.

Alternate solution: Allow a blank option for units, such that users can enter free-text into the custom size (for any units, not just fonts). That would further allow users to make use of more advanced length choices, such as "calc()"

@jordesign
Copy link
Contributor

Thanks for raising this suggestion @gungfujoe - I see there is an existing issue regarding additional/relative font sizes for fonts - so I'll close this issue in favour of that one.

#23323

@jordesign jordesign closed this as not planned Won't fix, can't repro, duplicate, stale Sep 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants