BlogsVercelWeb Font Optimization

Web Font Optimization

Web Font Optimization

3
posts
2023

Vercel's platform and tooling, including the next/font module, provide comprehensive solutions for optimizing web font loading and rendering. This includes leveraging `font-display` CSS properties, `size-adjust` and other font-face descriptors for layout shift prevention, and resource hints like `preconnect` and `preload` to reduce download times. The `next/font` module automates these optimizations by downloading fonts at build time, serving them locally, and automatically preloading them. This post details the transition from complex manual optimizations to the simplified and more performant `next/font` solution, which automatically handles self-hosting, subsetting, and layout shift prevention by calculating `size-adjust` on the server.

2023

Optimizing web fonts

9/26/2023

This post details techniques for optimizing web font loading and rendering to prevent layout shifts and reduce download times. It explains the use of `font-display` CSS properties (`block`, `swap`, `fallback`, `optional`, `auto`), the `size-adjust` font-face descriptor for matching fallback and web font metrics, and resource hints (`preconnect`, `preload`). It also highlights how the `next/font` module in Next.js automates these optimizations by downloading fonts at build time, serving them locally, and preloading them.

Why Vercel and Next.js are the perfect fit for this global fashion media group | Customers | Vercel

9/21/2023

This post highlights how L'Officiel Inc. leveraged Next.js's automatic webfont optimization as part of their migration to Vercel, contributing to a 60% increase in web traffic and improved SEO. The post specifically mentions that Next.js's built-in feature ensures custom fonts render fast at any weight by eliminating extraneous data fetches and ensuring timely rendering.

Custom fonts without compromise using Next.js and `next/font`

3/28/2023

This post introduces `next/font` as a streamlined solution for custom font optimization in Next.js. It details the complex manual workarounds previously used (self-hosting, preloading, subsetting, fallback fonts, client-side JS for new visits) and contrasts them with the simplified approach of `next/font`. Key benefits highlighted include automatic self-hosting, optimized character subsetting, and server-side calculation of `size-adjust` to prevent Cumulative Layout Shift (CLS) by generating a fallback font that matches the custom font's spacing. The post also covers configuration options like `display: 'swap'` and the use of the `variable` property for CSS integration, as well as its compatibility with the Next.js App Router.