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

Font Families as of WordPress 5.9 #86

Closed
douglas-johnson opened this issue Jan 18, 2022 · 2 comments
Closed

Font Families as of WordPress 5.9 #86

douglas-johnson opened this issue Jan 18, 2022 · 2 comments
Assignees

Comments

@douglas-johnson
Copy link
Member

Problem

The documation for WordPress 5.9 mentions the availability of settings.typography.fontFamilies for "blocks that support the font family style".

https://make.wordpress.org/core/2022/01/08/updates-for-settings-styles-and-theme-json/

The best we have for a complete list of which blocks support them is a search result from the gutenberg repo:
https://github.com/WordPress/gutenberg/search?q=__experimentalFontFamily

As linked from this issue.
WordPress/gutenberg#35920

Questionable Solution

My assumption is that we want more broad support for font families on sites that need them ( especially for headings and paragraphs ), but we might want to leave it out of other sites.

I am considering this using the new wp_get_global_settings() function to determine if the active theme has font family settings in theme.json. Then we could enable or disable supports.typography.__experimentalFontFamily for all blocks that have typography settings.

References

@richdacuban
Copy link
Collaborator

richdacuban commented Jan 19, 2022

@douglas-johnson

Then we could enable or disable supports.typography.__experimentalFontFamily for all blocks that have typography settings.

This would be done through a filter on the blocks? Something like editor.BlockListBlock?

EDIT: Or am I just misreading this and the way it works is that if we add fonts to the settings.typography.fontFamilies setting, they will just appear in the editor in the appropriate blocks?

A fontFamilies preset has been added. Themes can now provide a list of fonts to be displayed to the user in the blocks that support the font family style. WordPress doesn’t provide any font family by default.

If so, without us having to write extra logic to do so, then I think it's a good plan.

@douglas-johnson
Copy link
Member Author

douglas-johnson commented Jan 19, 2022

@richdacuban

This would be done through a filter on the blocks? Something like editor.BlockListBlock?

While testing I used a server-side filter on register_block_type_args

Or am I just misreading this and the way it works is that if we add fonts to the settings.typography.fontFamilies setting, they will just appear in the editor in the appropriate blocks?

Only if the block supports font families, which is tied to support for typography.__experimentalFontFamily. I'm proposing we enable that for any block that has any typography settings at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants