Skip to content

Enabling global styles to handle custom font declarations #23204

@jffng

Description

@jffng

To use a custom font, a theme today must do the following:

  1. Enqueue it
  2. Make a @font-face declaration in the theme’s stylesheet

As the current global styles mechanism is described, I think the steps would be:

  1. Enqueue it
  2. Make a @font-face declaration in the theme’s stylesheet
  3. Add the font to theme.json in presets and styles, something like:
    { global: { presets: { fonts: [ "my font", "other font", ... ] } } }

Is it possible that theme.json processes font declarations, making at least step 2 unnecessary? I think this moves slightly beyond generating a CSS custom property.

cc @carolinan

Metadata

Metadata

Assignees

No one assigned

    Labels

    CSS StylingRelated to editor and front end styles, CSS-specific issues.Global StylesAnything related to the broader Global Styles efforts, including Styles Engine and theme.json[Feature] ThemesQuestions or issues with incorporating or styling blocks in a theme.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions