-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
[Global Styles]: Add support for nameless font sizes #37410
[Global Styles]: Add support for nameless font sizes #37410
Conversation
This seems to work for me. I tried it alongside WordPress/twentytwentytwo#298 (both with and without In the case of Twenty Twenty-Two, I'm not sure we actually need to update our font sizes though. 🤔 Our current five sizes and provided names work just fine with this setup as is: I guess the main reason to do it would be to ensure we align with the t-shirt sizes if/when core switches to that. |
Thanks for the PR! I'm not sure what I'm doing wrong, but it wasn't working for me: This is with the following in my custom theme.json:
I feel like there's something I'm messing up with my system, because I'm also seeing the (px) unit next to the title, whereas it seems to be missing in the other screenshots. Is that due to the complex units from TT2?
I think "Normal" changing to "Medium" and "Huge" changing to "Extra Large" feel like good reasons to sync up TwentyTwentyTwo as well, since both the defaults and the default theme should showcase best practices. For the 4 base names, I'd even go so far as to remove the name value from the theme.json, and intentionally fall back to the default names. That is of course, unless I misunderstood how that was meant to work! |
Hm... this seems to work for me and I don't see something wrong with your
Yes, it due to the complex units. |
I'll give this another spin as soon as I get a moment, but just from my understanding this (with your confirmation), this is an important step forward 👍👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would encourage a code review of this, but from a theme.json perspective, thumbs up! Thanks for the work.
* add support for nameless font sizes * add test
I've cherry picked in --cc @tellthemachines |
Thanks @ntsekouras , I'll remove the backport label then. |
With nameless font sizes support, themes use the defaults by not declaring the `"name"` setting for their `fontSizes` in `theme.json`. Backport from Gutenberg WordPress/gutenberg#37410. Follow-up to [50973], [52049], [52275], [52320]. Props ntsekouras, costdev, hellofromTonya. Fixes #54640. See #54487. git-svn-id: https://develop.svn.wordpress.org/trunk@52401 602fd350-edb4-49c9-b593-d223f7449a82
With nameless font sizes support, themes use the defaults by not declaring the `"name"` setting for their `fontSizes` in `theme.json`. Backport from Gutenberg WordPress/gutenberg#37410. Follow-up to [50973], [52049], [52275], [52320]. Props ntsekouras, costdev, hellofromTonya. Fixes #54640. See #54487. Built from https://develop.svn.wordpress.org/trunk@52401 git-svn-id: http://core.svn.wordpress.org/trunk@51993 1a063a9b-81f0-0310-95a4-ce76da25c4cd
With nameless font sizes support, themes use the defaults by not declaring the `"name"` setting for their `fontSizes` in `theme.json`. Backport from Gutenberg WordPress/gutenberg#37410. Follow-up to [50973], [52049], [52275], [52320]. Props ntsekouras, costdev, hellofromTonya. Fixes #54640. See #54487. Built from https://develop.svn.wordpress.org/trunk@52401 git-svn-id: https://core.svn.wordpress.org/trunk@51993 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Very recently in this PR we updated the default font sizes - the new defaults have the slugs (
small
,medium
,large
,x-large
.With this PR we allow themes to skip the declaration of
name
of theirfontSizes
, if they want to support the defaults. What this means is that a theme can now provide their fontSizes like this:** Note the missing
name
field and that the slugs match thedefault
ones.Notes
slug
that isn't among the defaults, it will result to having noname
with all the bad implications that entails.slug
that is among the defaults, but provides aname
, the provided name will be used.Testing instructions
theme.json
nameless font sizes that use the core default slugs (example above)names
from the defaults are shown as labels.