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

Fonts provided by a parent theme are clobbered by fonts provided via Webfont Provider #6827

Open
pbking opened this issue Jan 18, 2023 · 0 comments

Comments

@pbking
Copy link
Contributor

pbking commented Jan 18, 2023

The following is happening:

Blockbase supplies a collection of fonts via theme.json.

In order for child themes to ALSO supply these same fonts they do NOT supply ANY fonts via theme.json. (If they did then ONLY the fonts supplied by the child theme would be available.)

Jetpack supplies a collection of fonts via Webfont Provider.

In Gutenberg the fonts provided by Jetpack are added to the "theme data" (in get_theme_data()) via a call to gutenberg_add_registered_webfonts_to_theme_json().

https://github.com/WordPress/gutenberg/blob/trunk/lib/class-wp-theme-json-resolver-gutenberg.php#L249

These fonts are added to the CHILD theme's "theme data". Thus (as noted above) those are the ONLY fonts that are now available. Therefore the fonts provided by the parent (Blockbase) aren't available and only those supplied by Webfont Providers (Jetpack) are.

Solutions considered:

  • Only add the fonts to the PARENT theme when processing in get_theme_data(). This works for the scenario of Blockbase (where child themes are expected to NOT supply any additional fonts). However in other potential scenarios if a child theme DOES supply fonts these additional fonts will NOT be included (since those fonts in the "child" theme data override those in the "parent")
  • Combine the fonts provided by the parent and child rather than using ONLY the parent (if the child supplies none) or the child (if it supplies some).
  • Do not add the fonts which have been added via webfont providers to theme data. Perhaps this collection could be added in a different way.

I'm not sure that any of these fixes can actually be accomplished with changes to Blockbase. The only possible solution Blockbase could offer would be to include those fonts via a Webfont provider instead of via theme.json. And since Blockbase has already made these fonts available to users who are NOT using the Gutenberg plugin this can only be accomplished once that capability is in CORE.

@pbking pbking changed the title Blockbase fonts are clobbered in Child themes Fonts provided by a parent theme are clobbered by fonts provided via Webfont Provider Jan 18, 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

1 participant