Font Optimization

Self-host Google Fonts, enable font-display swap, and preload critical fonts.

Last updated Feb 6, 2026

Why Font Optimization Matters

Web fonts are one of the most common causes of slow rendering. Loading Google Fonts requires DNS lookups, TCP connections, and TLS handshakes to external servers before a single character can render. BoostPro eliminates these bottlenecks.

Self-Host Google Fonts

Instead of loading fonts from Google's servers, BoostPro downloads the font files and CSS to your own server. This eliminates external network requests and improves GDPR compliance by keeping font requests on your domain.

  • Default: Off
  • What it does: Intercepts fonts.googleapis.com CSS URLs, downloads all font files (woff2, woff, ttf), and rewrites URLs to serve from /uploads/boost-fonts/
  • Cache duration: 7 days, with automatic background refresh
  • Size limit: 100MB total cache, with automatic cleanup of files older than 30 days

How the Cache Works

BoostPro uses a "stale-while-revalidate" caching strategy:

  1. First request: Downloads and caches fonts (may take a moment)
  2. Subsequent requests: Serves from local cache instantly
  3. After 7 days: Continues serving cached fonts while refreshing in the background
  4. Weekly cleanup: Removes files older than 30 days

Tip

After enabling self-hosting, clear your page cache so the new local font URLs take effect immediately.

Font Display Swap

By default, some browsers hide text until the web font loads (called Flash of Invisible Text, or FOIT). Font display swap tells the browser to show a fallback font immediately and swap in the web font once it's ready.

  • Default: On
  • What it does: Appends ?display=swap to Google Fonts URLs and adds font-display: swap to @font-face declarations
  • Impact: Text is visible immediately, improving perceived performance and LCP scores

Users may briefly see a fallback font before the custom font loads. This is called Flash of Unstyled Text (FOUT) and is generally preferred over invisible text.

Preload Key Fonts

Font preloading tells the browser to start downloading critical font files as early as possible, before the CSS that references them is even parsed.

  • Default: Off
  • Requires: Self-Host Google Fonts must be enabled
  • What it does: Adds <link rel="preload" as="font" type="font/woff2" crossorigin> hints in the <head>
  • Limit: Preloads up to 6 woff2 font files

Important

Only preload fonts that are actually used on most pages. Preloading fonts that aren't used wastes bandwidth and can hurt performance. This feature automatically selects from your cached font files.

GDPR Compliance

Loading Google Fonts from Google's servers sends your visitors' IP addresses to Google, which can be a GDPR concern (notably after the Austrian DPA ruling in January 2022). Self-hosting fonts addresses this concern since all requests stay on your domain.

Recommended Setup

  1. Enable Font Display Swap first (safe, immediate improvement)
  2. Enable Self-Host Google Fonts if your theme or plugins use Google Fonts
  3. Clear your page cache after enabling self-hosting
  4. Optionally enable Preload Key Fonts if you want maximum font loading speed
  5. Run a PageSpeed test to verify the improvement