-
Notifications
You must be signed in to change notification settings - Fork 63
Use generic font family slugs #22
Comments
I support this endeavor! 💯 🥳 |
I'm just throwing spaghetti here; What if we both allow users to use any of the fonts included while also allowing the variation to dictate which go where by default? Say we include all available fonts in the base theme. Therefore, any variation would have a specific font should the user choose one. Any of those fonts can be mapped to a (Body) or (Header) font by the variation. Should the user choose those options then their choice reflects whatever the variation dictates. Consider:
|
@pbking your suggestion is definitely worth exploration, but I would make sure it works with the current webfonts APIs. The |
I guess I'm curious about the expectations around the relationship between the parent The overall theme would get out of control if all style variations could use their own custom font and we would have to discuss how to break things up if we go down that road, but worth clarifying expectations a bit. |
I’ll be curious to see how and where we take the infrastructure here for parent and child style variations. Perhaps it would be warranted to have TT3 take on the following order:
This organization would cut down on overall package size and allow style variations to leverage their own custom fonts. Of course, we should still provide some guidelines on maximum overall font size. A lot of this discussion is beyond the boundaries of the original Issue and I’m happy to spin up another Issue to continue the conversation around theme expectations. 🙏 |
The more I think about this the more I'm of the opinion that the fonts should remain "Descriptive" rather than "Semantic" (which feels odd, I'm usually Mr. Semantic Champion). The opinion as to what "headers" are could vary. Is that just heading blocks? Post Titles? Site Title? That decision feels a lot like opinion that belongs in the variations. Rather, considering that the base theme actually only uses one font family I think that it would be better to have variations customize (at a minimum requirement) the And while I believe that the variations that ship with the default theme should all ultimately depend of resources bundled with the theme I would also love to see the ability to also leverage variations that can use remotely provided fonts WordPress/gutenberg#43189. |
I'm not tied to either the descriptive or semantic slug names, but mostly towards functionality and application. I.e. I'm open to any other slug names. I think the current suggested naming convention from @richtabor likely stems from historical web design. It is pretty standard to have a headings font and contrast with a body font. But, a lot of times it is just a matter of the heading and body font being the same font, but having different weights. So, the |
We originally did such a thing with Blockbase where a Header and Body font are declared. Each child was free to designate different font families to just those values and allow a user to change them via the Customizer. Patterns and themes were empowered to leverage those standardized values. What we observed was that many themes leveraged only a single font. That meant a little extra configuration for them. Hardly any patterns or templates leveraged those values. When they did we found it was better to change configuration in theme.json instead. It was nearly always better to allow the underlying configuration flow through. And as to their re-use in theme.json configuration, we found that only two blocks ever leveraged the header value (wp-header, wp-page-title) and nothing the body. We've found it more expressive, if perhaps a bit more verbose, to allow child themes and variations the ability to describe where the fonts go. So with v2 we transitioned any configuration from body/heading to individual block configuration settings. The matter of those font values being unavailable should a user choose them and change themes; There's no guarantee that the theme they are switching to follows the same pattern. Better to try to express the configuration of fonts in a way that users aren't inclined to change individually but rather at a global level. |
It might help to guide this conversation if we were to refine the expectation of what fonts and how fonts should be used in this theme? @beafialho @mikachan are the goals for TT3 to only leverage the following font families in all submitted style variations:
|
@mikachan My question is a little off-topic on the issue but is there any reason to use DM Sans font in the |
Apologies, I've only just read this conversation. Thanks for the ping!
Yes, I believe this is the intention. Or rather, there should be a limited set of font families bundled with the theme, but the final set may change based on what people would prefer to use. For example, we may collectively decide to swap Source Serif Pro for a different font. Considering we have a limited set of fonts to work with, I really like this idea:
Especially in regards to creating a directory of many community-contributed style variations that are perhaps not bundled with the default theme, but offer a variation that is designed to work with TT3 easily and without any required customization. |
No good reason other than these are the versions of the files used in TT2. Having them in woff or woff2 format sounds like a better plan! |
We should consider using more generic font-family slugs (i.e.
body
,heading
, etc) instead of slugs that are specific to the font family that is registered withinsettings.typography.fontFamilies
.The fonts loaded within
settings.typography.fontFamilies
are only available on the active style, resulting in CSS variablesWhy:
If a the parent theme.json file registers a font, like DM Sans, and uses a slug of
dm-sans
— whenever we switch styles we're left with an undefined CSS variable output wherever we used"fontFamily": "var(--wp--preset--font-family--system-font)"
.Also resulting in none of the parent theme.json's font family values will carry over to subsequent styles.
Below is a screenshot of the CSS generated if you have a specific font-family slug from the parent theme.json that is not available (different font) from a style variation.
Proposal:
Instead if we used
body
andheading
slugs, then those CSS variables will be meaningful within other style variations. A heading with"fontFamily": "var(--wp--preset--font-family--heading)",
assigned to it, still maintains the style variant's fontFamily that has the slug ofheading
.Having a style that actually inherits the parent style seems the best foot forward in my opinion. And even if we end up not having fontFamilies within the parent theme.json, we should still have these consistent values across the theme — from variation to variation. Example: if I choose my theme's heading font (DM Sans) then switch styles, then that style variation's heading font should take over wherever I used the previous one.
What do you think?
Screenshot:
The text was updated successfully, but these errors were encountered: