Opened 3 years ago
Closed 3 years ago
#54702 closed enhancement (reported-upstream)
Feature Request: Broad control over typography in Global Styles
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 5.9 |
Component: | Editor | Keywords: | |
Focuses: | Cc: |
Description
Not sure if this belongs here or in GitHub, so I put it in both places. It's in GitHub as #37635.
What problem does this address?
WordPress currently gives either too much or too little flexibility when selecting fonts. Blockbase looks like it's trying to address this but hasn't yet figured out what it wants to do. I'm proposing an approach for fonts that's similar to what Gutenberg is doing with colors. Let the theme be as opinionated as it wants to be and lock things down tight if it wants to. But if it allows customization of fonts, then have WordPress give the control to the admin to define available font schemes and lock things down for end users.
What is your proposed solution?
Here's my initial proposal for a replacement for the current Typography panel in Global Styles:
The Typography Palette shows the currently available fonts. They may be the limited list provided by the theme, or they may be customized by the admin.
Clicking that palette opens up its details and allows editing (if the theme allows it):
Blockbase currently defines two roles: Body and Headings. There are good reasons to occasionally have more than just those two typefaces playing just those two roles. The Typography Palette would give me a way to define additional typefaces, along with the named roles those typefaces would play. A theme designer could opt to forbid the creation of custom typeface roles if they wanted to constrain the admins.
The Typography Palette editor would work similar to how the Color Palette editor works. If the theme doesn't forbid it, then the theme's roles could be edited to select different typefaces. In addition, if the theme doesn't forbid it, an admin could define custom named roles and assign typefaces to those, much like they can create custom colors in the Color Palette editor.
Blockbase also automatically knows how to import a small subset of Google fonts, but not all of the good ones that an admin might want to use on their site. When assigning a typeface to a named role, an admin can choose from among the easy-to-choose list that the theme makes available, or they could define the necessary details to allow us to import the typeface definition from an external source.
Back to the root Typography panel in Global Styles again:
After the Typography Palette has been filled with a limited number of typefaces (assigned to named roles), those roles can then be used to create Font Schemes. Themes already do this to some degree, but this proposal gives a lot more clarity and control to the site admin in Global Styles.
Clicking on a Font Scheme reveals this editor:
Clicking an element would open up the standard Gutenberg font editor being defined as part of #34345.
If someone defines all these things and then switches themes, their named font schemes would remain. If the admin assigned a theme-provided font to a named role and that font is no longer available in the new theme, then one of the new theme-provided fonts would be selected to replace it.
Finally, when adding blocks to a page or template part, the editor for supported blocks would allow us to select one of the named font schemes, and the content rendered inside that block would use the fonts defined for that font scheme.
Initial Typography Panel Proposal