Skip to content

next/font recommendation breaks letter-spacing #47575

@Janpot

Description

@Janpot

Steps to reproduce

Steps:

  1. Follow steps in https://mui.com/material-ui/integrations/nextjs/#font-optimization
    'use client';
    import { createTheme } from '@mui/material/styles';
    
    const theme = createTheme({
      typography: {
        fontFamily: 'var(--font-roboto)',
      },
    });
    
    export default theme;
  2. Notice the letter-spacing is off in Typography components

Current behavior

Switching between the two:

Screen.Recording.2026-01-07.at.10.52.35.mov

Expected behavior

No response

Context

Noticed this in mui/mui-public#1020

Caused by

// The letter spacing was designed for the Roboto font-family. Using the same letter-spacing
// across font-families can cause issues with the kerning.
...(fontFamily === defaultFontFamily
? { letterSpacing: `${round(letterSpacing / size)}em` }
: {}),

The fontFamily is set to 'var(--font-roboto)' and therefore doesn't correspond to the default fontfamily, therefore the letter-spacing intended for roboto is not applied, yet the font is roboto.

Your environment

npx @mui/envinfo
  Don't forget to mention which browser you used.
  Output from `npx @mui/envinfo` goes here.

Search keywords: next/font letter-spacing

Metadata

Metadata

Assignees

No one assigned

    Labels

    has workaroundThere’s a bug, but users have a complete workaround, so no urgent fix or release is needed.integration: nextjsNext.jsscope: typographyChanges related to typography.type: bugIt doesn't behave as expected.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions