Thanks to visit codestin.com
Credit goes to github.com

Skip to content

'font-family' declarations are not used #75898

Closed
@jonasvle

Description

@jonasvle

Link to the code that reproduces this issue

https://github.com/jonasvle/font-reproduction/blob/master/src/app/globals.css

To Reproduce

Define a localFont with custom 'font-family' via declarations.
e.g.

const block_berthold = localFont({
  src: '../app/fonts/BlockBerthold-Condensed.ttf',
  declarations: [
    {
      prop: 'font-family',
      value: 'Block Berthold',
    },
  ],
});

Current vs. Expected behavior

I expect to be able to use the font via font-family: 'Block Berthold', but I can only use it via font-family: 'block_berthold'.

Provide environment information

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 11 Pro
  Available memory (MB): 32421
  Available CPU cores: 20
Binaries:
  Node: 20.14.0
  npm: 10.7.0
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  next: 15.1.6 // Latest available version is detected (15.1.6).
  eslint-config-next: 15.1.6
  react: 19.0.0
  react-dom: 19.0.0
  typescript: 5.7.2
Next.js Config:
  output: standalone

Which area(s) are affected? (Select all that apply)

Font (next/font)

Which stage(s) are affected? (Select all that apply)

next dev (local), next build (local), next start (local), Other (Deployed)

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Font (next/font)Related to Next.js Font Optimization.linear: nextConfirmed issue that is tracked by the Next.js team.locked

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions