-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Global Styles/Typography: Managing fonts #45271
Comments
I think it would be possible to parse the font files to extract the name and the style (at least, I know this is true for If we could have that, then the upload flow could be more simple: users upload a file and then we expose the metadata on a second step (perhaps there's no need to let users customize the font details). |
Also, aren't font style and font weight the same thing? 🤔 |
Nice, that seems ideal. If that seems feasible in implementation, probably the path to lean towards.
They are combined in a single "Apperance" menu in the UI, and should remain as such, but in case we aren't able to extract these properties as metadata, CSS-wise the font definition does need separate values for
I.e. the above would show up as a single "Bold Italic" option in the apperance menu. All the more reason to extract metadata if we can. |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Wouldn't it also be a good idea to have a separate admin page or a bigger modal (like for the settings) to view/edit/upload custom fonts, like in the Create Block Theme plugin? Just like @carolinan mentioned it here: https://twitter.com/carolinapoena/status/1590207811681935362 I feel like the fonts should not be squished into the right sidebar of Gutenberg. |
Yes, I think there's an opportunity to do that, potentially as part of #45346, which explores moving the Styles tab to the left. That would afford opening a fonts management screen just like there's a templates screen. It would need a little exploration, and I like to think we can start with a modal, but it makes sense. |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
Mockups here have been updated to reflect some of the ongoing conversations in #53884. |
@mikachan Just making sure you've seen these mockups. I don't know that we need any snackbars as part of the flow at all. |
Thanks @jasmussen, I agree, I don't think we need any snackbars at all. |
I was unable to connect this issue to the PR (GitHub would not cooperate)
|
Considering how many individuals are in place for the font library for 6.5 including this specific tracking issue #55277, I'm going to remove this from the board. Let's consider closing this out too as I'm not sure how relevant it is to the work over the last 4-6 months at this stage! |
Fonts and font weights can be defined in
theme.json
in settings.typography.fontFamilies.fontFace.See example code
There isn't yet a user interface for it. Here are mockups to explore how you should be able to add fonts. The main interface for managing fonts would live in Global Styles → Typography, where a plus button would let you add a font from Google Fonts:
Note importantly that before you connect to Google fonts, you have to give consent to allow that connection to happen, as shown in the mockup above. If you have feedback on the copy, please share it, the consent box can be as verbose as it needs to be.
The modal is to be considered a "Font Library" and behaves just like the image media library, in that it is a silo of fonts, both those you have uploaded manually, or added from Google. But the sidebar list of fonts shows only the subset that are active and available to choose in your font pickers (and saved to theme.json). In that vein the checkboxes for each font weight also denote which fonts are "active":
There's a separate Upload tab:
When there are no fonts installed, there should be a bigger button to open the fonts dialog:
This issue was updated Aug 30.
Earlier version that were inline in the sidebar
But there isn't yet a user interface for it. Here are mockups to explore how you should be able to add fonts. The main interface for managing fonts would live in Global Styles → Typography, where a plus button would let you add a font from Google Fonts:
Uploading fonts would be available from the same interface, featuring a dropzone also serving as an upload button:
This same interface would also allow you to select or unselect font-weights used:
The above three mockups would round out the main tasks for additing and managing fonts and their weights.
Separate explorations could include an upgraded font picker for selecting fonts featuring a visual preview:
Here's also an early draft at how to manage variable width fonts:
There are a number of open questions still to be explored around how variable width fonts are best leveraged, and the files themselves allow for many interesting effects, including animated transitions. For now, this mockup simply treats it as a source of virtually infinite font weights that can be leveraged.
Initial proposal
Let's surface an interface both for picking font sets (a primary font for headings and a secondary font for body text), as well as for managing the set properties. It could live in Global Styles → Typography:
You'd be able to manage font weights:
If you are starting from scratch and have no defined font weights, only a plus to add a new font is shown:
sans-serif
,serif
, ormonospace
)You can use just a single font as both primary and secondary:
Aa
font preview shows the capital A in bold, denoting the primary font, and the lowercase a in regular font weight, denoting body text, and matching default browser values.A basic interface for uploading fonts can be found in the ellipsis menu:
This upload interface assumes that font metadata such as name, style, and weight, can be extracted and applied to the font-face definition. If this is non-trivial, we can surface separate input fields for these values:
A library for managing uploaded assets like these can be explored separately, and linked here.
The text was updated successfully, but these errors were encountered: