Make WordPress Core

Opened 8 months ago

Last modified 8 months ago

#60957 new defect (bug)

Install fonts in Font Library in WP 6.5 not working on multisite using Twenty Twenty-four

Reported by: hartsook's profile hartsook Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 6.5
Component: Editor Keywords:
Focuses: multisite Cc:

Description (last modified by sabernhardt)

Fonts install in the e.g. "uploads/sites/8/fonts" directory on the proper "site" in multisite. The new font shows up in the Font Library in Styles Typography, but is not rendered either in the Style Book or the front end.

Here is the theme.json for the installed font:

		"fontFace": [
			{
				"fontFamily": "\"Alegreya Sans SC\"",
				"fontStyle": "normal",
				"fontWeight": "500",
				"src": "http://eosfse.movingmoment.com/wp-content/uploads/sites/8/fonts/mtGm4-RGJqfMvt7P8FUr0Q1j-Hf1DrpG0iFrMYJ_K-4.woff2"
			},
			{
				"fontFamily": "\"Alegreya Sans SC\"",
				"fontStyle": "italic",
				"fontWeight": "500",
				"src": "http://eosfse.movingmoment.com/wp-content/uploads/sites/8/fonts/mtGk4-RGJqfMvt7P8FUr0Q1j-Hf1BkxdBidhMKB6O-51OA.woff2"
			}
		],
		"fontFamily": "\"Alegreya Sans SC\", sans-serif",
		"name": "Alegreya Sans SC",
		"slug": "alegreya-sans-sc"
	}
],

Attachments (1)

Screen Shot 2024-04-09 at 8.38.24 am.png (51.3 KB) - added by peterwilsoncc 8 months ago.

Download all attachments as: .zip

Change History (8)

#1 @hartsook
8 months ago

BTW, the html/css thinks it's getting the Alegreya Sans SC, but that's not the font that's being displayed:

h2 {

font-family: var(--wp--preset--font-family--alegreya-sans-sc);
font-size: var(--wp--preset--font-size--large);

}

#2 @peterwilsoncc
8 months ago

Hi @hartsook and thanks for the ticket.

I'm unable to reproduce this bug, adding the font via the font library on a sub site displays as expected (see screen shot). The steps I took are:

  1. Install fresh Multisite installation
  2. Create sub site
  3. Install Alegreya Sans SC font via site editor
  4. Set the new font for all elements (Headings, text, captions, etc) in the style editor
  5. Save site & open front end, fonts appeared as expected
  6. Repeat set up for sub-site, fonts appeared as expected

Fonts added via the font library are configured via the global styles, it's not required to add the font library fonts in theme.json. For theme fonts, you can include the file in the theme and reference them with file values.

While looking at the JSON you provided, I also noticed an apparent typo: there are two closing square brackets but only one is opened.

#3 @peterwilsoncc
8 months ago

@hartsook I've posted a reply but it appears trac had a glitch sending out the notifications.
https://core.trac.wordpress.org/ticket/60957#comment:2

#4 @sabernhardt
8 months ago

  • Description modified (diff)

I get mixed content errors in the browser console. The site enforces HTTPS, but the font refers to the unsecured (sub)domain.

#5 @poena
8 months ago

I am also unable to reproduce this on a fresh Multisite installation.

I'm not sure the theme.json is relevant if the font is installed with the Font Library and the font is applied to the blocks in the Site Editor. Font family changes that are made in the Site Editor are saved in the database and are used instead of theme.json.

Perhaps there are steps to reproduce it that are missing?

After installing the font using the Font library, did you export the theme to get the updated copy of theme.json?
Or did you manually add it to theme.json? For what purpose?

#6 @hartsook
8 months ago

I used Create Block Theme plugin feature to save the changes to the theme.json.

#7 @poena
8 months ago

  • Component changed from Themes to Editor
  • Severity changed from major to normal
Note: See TracTickets for help on using tickets.