Problem/Motivation

Found when performance testing Drupal CMS with Mercury/Gin but the same applies to the admin theme in core.

Mercury uses inter-var.woff2, but Gin uses inter.woff2 - this results in two fonts being downloaded for what is the same font. This happens on the Drupal CMS front page too - not entirely sure why Gin fonts are loaded on the front page, maybe to do with Canvas?

If we used a variable font everywhere, it should avoid the duplication, or at least make it easier to de-duplicate if it still happens.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Comments

catch created an issue. See original summary.

godotislate’s picture

Core Navigation uses inter-var as well, so it'd make sense to share between default_admin and navigation somehow and make it available to Mercury.

Per @catch in slack:

We could subset the font, so non-roman glyphs go in their own files then are loaded conditionally based on brower locale.

We might need to ship the files in core/assets or something.

Looking at inter docs it has > 2000 glyphs so subsetting ought to help a lot

mherchel’s picture

Yeah, this definitely needs to be tackled.

We need some discussion on how, though.

Requirements

  1. Same font needs to load when Navigation and Admin are loaded
  2. Same font needs to load when only Navigation is loaded
  3. Same font needs to load when only Admin is loaded

My first thought is to move the font file + accompanying CSS into core.libraries.yml. Then both the module and theme (and any other contrib) can reference them. Thoughts?

catch’s picture

My first thought is to move the font file + accompanying CSS into core.libraries.yml. Then both the module and theme (and any other contrib) can reference them. Thoughts?

I'd thought about moving the font itself, but not the CSS yet, on the basis that if the font file is cached different font declarations would probably not result in a double load. But adding a core library for the CSS itself makes a lot of sense. If we subset the font it will increase the complexity of the CSS too so much easier to maintain in one place, will also mean preloading is centralised too etc.

pameeela’s picture

Issue tags: +DrupalSouth 2026