Skip to content

Add development font fallback#13942

Merged
gregorbg merged 8 commits intothewca:mainfrom
coder13:codex/dev-font-fallback
Apr 25, 2026
Merged

Add development font fallback#13942
gregorbg merged 8 commits intothewca:mainfrom
coder13:codex/dev-font-fallback

Conversation

@coder13
Copy link
Copy Markdown
Contributor

@coder13 coder13 commented Apr 6, 2026

Implemented by codex and tested locally

What changed

  • use a free Google font as the default public-repo font implementation
  • move the TTNormsPro local font loader into a production-only module
  • keep the layout font selection behind a small helper

Why

  • the public repo cannot bundle the proprietary TTNormsPro assets
  • Next was still resolving the local font module during development and failing on the missing .woff2 files
  • this keeps development working without changing the intended production path

Impact

  • development uses the free fallback font
  • production can still opt into TTNormsPro through the production alias and PROPRIETARY_FONT=TTNormsPro

Validation

  • yarn check:types

@coder13 coder13 changed the title [codex] Add development font fallback Add development font fallback Apr 6, 2026
@coder13 coder13 marked this pull request as ready for review April 6, 2026 16:36
@coder13 coder13 requested a review from FinnIckler April 6, 2026 16:39
Copy link
Copy Markdown
Member

@gregorbg gregorbg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Here are some thoughts and "historical knowledge" on the font loading from me :)

Comment thread next-frontend/src/styles/appFont.ts Outdated
Comment on lines +11 to +13
const { ttNormsPro } = await import("@/styles/fonts");

return ttNormsPro;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the Webpack import rewrite, is this asynchronous approach even still necessary now?

It has "grown to be" this await import syntax, precisely because we tried very hard to avoid Webpack trying to load the font files. Ultimately, it never worked though, so technically even in the current status quo codebase the await import is completely unnecessary.
With your custom import resolution, I would expect that it is even more unnecessary. So I have a hunch that this can be hugely simplified and turned into a fully synchronous function.

Comment thread next-frontend/src/styles/fonts.ts Outdated
Comment thread next-frontend/src/styles/appFont.ts Outdated
Comment thread next-frontend/src/styles/fonts.ts Outdated
{ prop: "descent-override", value: "-33%" },
],
});
const ttNormsPro = Rubik({ subsets: ["latin"] });
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we now not just rename both of these too appFont?

],
});

export { ttNormsPro };
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we now not just rename both of these too appFont?

@gregorbg
Copy link
Copy Markdown
Member

Your original PR description says "tested locally". What exactly have you tested?

I cannot opt into the proprietary files on my local machine. Even if I use a console.log to verify that the if branch in your webpack rewrite is indeed really entered (and I reboot my NextJS dev environment completely, just for good measure), I still get the Rubik fallback font.

@gregorbg gregorbg force-pushed the codex/dev-font-fallback branch 2 times, most recently from 2fc95eb to cd23889 Compare April 25, 2026 10:38
Copy link
Copy Markdown
Member

@gregorbg gregorbg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for commandeering your PR, but even though I had the proprietary font files available it still took a heck of a long time to debug this. SWC is persistent about localFont like you wouldn't imagine!

@gregorbg gregorbg merged commit 392b9ad into thewca:main Apr 25, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants