[wp-trac] [WordPress Trac] #54702: Feature Request: Broad control over typography in Global Styles
WordPress Trac
noreply at wordpress.org
Mon Dec 27 23:45:07 UTC 2021
#54702: Feature Request: Broad control over typography in Global Styles
-------------------------+-----------------------------
Reporter: sdwire | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Customize | Version: trunk
Severity: normal | Keywords:
Focuses: |
-------------------------+-----------------------------
Not sure if this belongs here or in GitHub, so I put it in both places.
It's in GitHub as [https://github.com/WordPress/gutenberg/issues/37635
#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:
[[Image(https://user-
images.githubusercontent.com/11800061/147509644-ae4bb1c9-e424-4af1-b058-d3f7c32f6322.png)]]
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):
[[Image(https://user-
images.githubusercontent.com/11800061/147509754-9334de15-761a-
481c-8924-8445a4642b74.png)]]
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:
[[Image(https://user-
images.githubusercontent.com/11800061/147509754-9334de15-761a-
481c-8924-8445a4642b74.png)]]
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:
[[Image(https://user-images.githubusercontent.com/11800061/147510338
-5e48069f-a6ab-4b6d-aba2-b6777ddf87f8.png)]]
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.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/54702>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list