-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Font Library: settings for using local vs. remotely hosted fonts #58229
Comments
An initial idea for the design of this setting:
This leaves open the question when these settings oppose each other: a collection requires downloading, but the editor is set to use the remote font url as its src.
|
Noting there are a couple existing explorations of adding settings for this: |
Well put @creativecoder thank you. Below are the scenarios that I have considered. I'm not sure if all of them would be legit scenarios so maybe we could simplify by eliminating something. Or maybe I missed a scenario completely. But this is where my head has been... Host only wants users to install the fonts that they provide via a plugin. The host builds the custom plugin which provides a list of fonts that a user can install. All users get this list of fonts they can activate and no others. These are what they support. The host only serves locally hosted assets provided by a plugin.
Host wants to allow users to install fonts from wherever they want, but won't allow the fonts to be hosted from a CDN. This includes the default fonts, other fonts added via plugins or other fonts that users may want to upload to install. The host will serve only locally installed fonts.
A host will allow fonts to be used and doesn't care where they are hosted. They can be uploaded and installed. A font provider will provide fonts and will allow those font resources to be loaded from their CDN. Another font provider will provide fonts and won't allow them to be served from their CDN. The system will have a mix of self and remote hosted resources.
A host will allow users to install fonts, but won't allow resources to be uploaded. Only remotely provided fonts and fonts with resources provided in plugins can be used. Uploading fonts won't be allowed. Collections that provide fonts that must be installed cannot be used. Plugins that supply font resources can be used. Collections that allow font resources to reference the font CDN can be used.
|
Closely related issue: #58883 |
Noting that another setting we need to consider is the constant |
Unless I'm missing something, currently there isn't an option to load Google Fonts remotely. Is it planned? |
It's technically possible the load a font remotely (because global styles supports it), but correct that there's currently no option to do so in the font library modal.
It's planned in the sense that some of us who have been working on the feature want to add it 😄 |
Thanks @creativecoder.
Does it mean it can be done with a filter? |
Not currently. Using the |
Thanks, @creativecoder. You refered to https://developer.wordpress.org/themes/global-settings-and-styles/settings/typography/#registering-web-fonts-font-faces for the option of providing a remote URL. I was actually going through this page before and couldn't find such an option mentioned, and was not able to make it work with guesswork. Do you maybe know how to provide a remote URL in the Thanks. |
@asafm7 Here's an example, loading "Inter" from Google Fonts directly. {
"$schema": "https://schemas.wp.org/trunk/theme.json",
"version": 2,
"settings": {
"typography": {
"fontFamilies": [
{
"fontFace": [
{
"fontFamily": "Inter",
"fontStretch": "normal",
"fontStyle": "normal",
"fontWeight": "400",
"src": [
"https://fonts.gstatic.com/s/inter/v3/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa1ZL7W0Q5nw.woff2"
]
}
],
"fontFamily": "\"Inter\", sans-serif",
"name": "Inter",
"slug": "body"
}
]
}
}
} |
Thanks @creativecoder. |
The default behavior for installing fonts to a site's Font Library from a font collection is to upload the font, so that it is hosted on the site.
This may not be the desired behavior, depending on who hosts the remote font and what the site owner desires. Remote hosting with a CDN may be more performant for loading the font, but may also come with privacy concerns.
For the site, whether to host the font locally or host from the source should be configurable (via hooks, if not through the UI).
The provider of a font collection, when not bundling fonts for distribution in a plugin but hosting them on a server, may or may not want their server used as a font CDN, so should be able to specify if downloading the font to the site is required to use it.
More information about Font Collections, for context: #57980
The text was updated successfully, but these errors were encountered: