October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
@font-face

How to Load Custom Fonts in Website Screenshots (and Stop Fallback Fonts)

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To capture the intended typeface, make the font reachable to the browser, define the correct @font-face family/weight/style, apply it to the page, wait for document.fonts.ready, and only then capture. A navigation-complete event alone is not enough: browsers can still be downloading fonts or reflowing text.

The reliable capture sequence

  1. Open the page in the same browser environment used for production captures. The browser must be able to reach the font stylesheet and font files. A font installed on your laptop is irrelevant to an isolated renderer unless that renderer has the font too. Cloudflare documents that Chromium falls back when a requested font is not pre-installed, while also supporting an injected external URL or Base64 font source (Cloudflare Browser Run screenshot documentation).
  2. Wait for navigation and page content. If your application changes text, classes, or styles after navigation, let those changes finish before waiting for fonts.
  3. Wait for used fonts and layout. Run await page.evaluate(() => document.fonts.ready). MDN defines this promise as fulfilled when loading and layout operations for all used fonts are complete (MDN FontFaceSet.ready).
  4. Capture the image or PDF. If later JavaScript changes typography, wait for document.fonts.ready again.

MDN’s wording matters: readiness covers fonts the document actually uses, not every face merely declared in CSS. An optional weight that never appears on the page may not be fetched.

Playwright: capture a page that already loads its font

Use this pattern when the production page has a working stylesheet and the capture browser has network access:

import { chromium } from 'playwright';

const browser = await chromium.launch();
const page = await browser.newPage({ viewport: { width: 1440, height: 900 } });

await page.goto('https://example.com', { waitUntil: 'networkidle' });
await page.evaluate(() => document.fonts.ready);
await page.screenshot({ path: 'page.png', fullPage: true });

await browser.close();

The networkidle condition is useful for pages that continue loading assets, but it is not a font guarantee. The explicit font wait is the important step. If a consent action, route transition, or client-side render changes the content, perform that action first and wait again.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB
  • CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
  • WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
  • A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents

Injecting a font with @font-face

Injection is useful in managed or isolated sessions, for visual regression fixtures, and when you must supply a known font independently of the target site’s CSS. Cloudflare’s browser documentation shows adding a style tag before a screenshot or PDF. This adaptable example uses a reachable WOFF2 URL:

await page.addStyleTag({
  content: `
    @font-face {
      font-family: 'CustomFont';
      src: url('https://your-cdn.example/fonts/custom.woff2') format('woff2');
      font-weight: 400;
      font-style: normal;
      font-display: block;
    }
    body {
      font-family: 'CustomFont', sans-serif;
    }
  `
});

await page.evaluate(() => document.fonts.ready);
await page.screenshot({ path: 'custom-font.png', fullPage: true });

The URL above is illustrative; replace it with a font you are licensed to use and that the capture browser can access. If the file is Base64-encoded, put the resulting data URL in src instead. Match every descriptor to the actual file and the styles used by the page:

  • font-family must be exactly the family name referenced by the page.
  • font-weight must match the requested weight (for example, 400 versus 700).
  • font-style must distinguish normal, italic, or oblique faces.
  • Use a separate @font-face rule for each weight/style file, or provide a variable-font range when the file supports one.

A CSS family declaration does not download a face by itself. The browser first obtains the stylesheet and then requests the appropriate font format. Google’s documentation explains this loading chain and recommends a fallback family (Google Fonts getting started guide).

Loading Google Fonts correctly

For a page using Google Fonts, include the generated stylesheet in the page or test fixture, then reference the requested family with a fallback:

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Philips 22 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 221V8LB
  • CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
  • SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap">
<style>
  body { font-family: 'Inter', sans-serif; }
</style>

The browser downloads the stylesheet and then the font format appropriate for its user agent. Google’s documentation notes that the API serves a stylesheet generated for the requesting user agent. If your capture environment blocks external requests, self-host a properly licensed file or inject one instead. A fallback such as sans-serif keeps the page readable when the requested face is unavailable, but it does not make the screenshot visually equivalent.

Why screenshots show the wrong font

The renderer cannot reach the file

Check the exact stylesheet and font requests from inside the capture environment. DNS restrictions, authentication, CORS policy, blocked third-party resources, or an incorrect relative URL can all leave the browser with only its fallback. Cloudflare specifically states that a font outside Chromium’s pre-installed set falls back to a similar supported font.

The family, weight, or style does not match

A file declared as 400 normal will not satisfy a request for 700 bold italic. Inspect the computed font-family, font-weight, and font-style on the element in the screenshot. Correct the descriptors or add the missing face.

The capture occurs during a transitional render

Google documents blank text while a font loads in Chrome and Safari, and an initial default-font render followed by a re-render in Firefox. A premature capture can therefore differ by browser even with identical HTML. Wait for document.fonts.ready after the last typography-changing action.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Dell 24 Monitor - SE2426H - 23.8-inch FHD (1920x1080) 144Hz 1ms Display, in-Plane Switching (IPS) Technology, AMD FreeSync™, TÜV 3-Star 2X HDMI, Tilt
  • Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
  • Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
  • Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
  • In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
  • Ultra-thin bezels: Maximize your viewing experience with thin bezels.

The face is declared but not used

Use the browser’s font inspection tools or the CSS Font Loading API to verify that the visible element actually selected the intended face. document.fonts.ready does not promise that every declared face was downloaded; it concerns used fonts and current layout work.

Choosing between page CSS and injection

Approach Best fit Checks before capture
Let the page stylesheet load the font The production page already has valid font setup Renderer network access, successful font requests, correct family/weight/style, and a post-navigation font wait
Inject @font-face Managed sessions, deterministic tests, or pages that need a supplied font Reachable or embedded source, matching descriptors, CSS specificity, licensing, and a font wait

Advanced capture considerations

Multiple routes and late content

Single-page applications can request a new weight after navigation. Wait after route changes, expanding components, cookie decisions, or data hydration. If a screenshot includes a hidden menu that becomes visible during interaction, its font may be newly used and require another wait.

PDFs and full-page images

Wait before either operation. Full-page layout can expose headings or footers that were not visible in the initial viewport, so ensure their weights and styles are supplied too. For repeatable output, keep viewport, device scale, browser version, and font files fixed.

Licensing and privacy

Use fonts licensed for web embedding and confirm that a managed capture service may fetch them. If the font is private, prefer an authenticated request or embedded data handled according to your security policy; do not place private keys in client-visible CSS.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor
  • CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
  • SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
  • MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
  • KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
  • INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient

Performance

WOFF2 is generally the practical web format, but the correct choice depends on your browser targets and licensing. Request only the weights and character ranges the page needs. Google’s guide says text= requests can reduce a font response by up to 90% in some cases; that is a subset optimization, not a guarantee about screenshot timing.

Troubleshooting checklist

  • Fallback everywhere: open the font URL from the renderer, inspect response status and content type, then verify the CSS family spelling.
  • Only bold or italic is wrong: add the corresponding file and matching @font-face descriptors.
  • Works locally, fails in CI: remove reliance on locally installed fonts; provide a reachable stylesheet, self-hosted file, or injection.
  • Intermittent visual diffs: wait for fonts after every late DOM/style change and avoid capturing during animations or layout transitions.
  • document.fonts.ready resolves but text is still wrong: inspect computed styles and actual font usage; readiness cannot correct a selector or descriptor error.
  • Cross-browser mismatch: compare the renderer’s browser version and available fonts. The documented Chrome/Safari blank-text and Firefox fallback-flash behaviors explain different intermediate frames, but do not cover every current configuration.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

ScreenshotNeo provides a website screenshot API and MCP server. Its capture options include custom CSS and JavaScript, so you can inject a font rule and wait for the page before taking a clean image or PDF. Cookie banners, newsletter popups, and chat widgets are removed before the shot; bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, with the response identifying the page verdict and billing status. AI agents can use its MCP tools, including take_screenshot, get_page_info, and capture_pdf.

One-call cURL example (see the ScreenshotNeo API documentation):

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

Use the API’s custom CSS/JavaScript options to add your @font-face rule and a font readiness wait for the target page. ScreenshotNeo includes 1,000 screenshots per month free with no card; paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Browser support and verification

MDN lists Document.fonts and FontFaceSet.ready as widely available, with availability across browsers documented since January 2020. Production pipelines should still verify the actual automation browser and version, because font rendering, network policy, and installed-font sets are environment-specific. Keep a known test page containing each required family, weight, and style; fail the job or flag the artifact when the expected face is unavailable.

Best Value
Sale
Sceptre New 22-Inch Gaming Monitor, FHD 1080p, Up to 144Hz, HDMI, DisplayPort, Built-in Speakers, Machine Black (E225W-FW144 Series, 2026)
  • 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
  • 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
  • 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.

Frequently Asked Questions

Does waiting for page load guarantee that custom fonts are ready?

No. Navigation completion and network-idle conditions do not prove that used fonts and their layout work are finished. Await document.fonts.ready after the final content or style change.

Can I use a font installed on my computer in a cloud screenshot job?

Only if the cloud browser has that font installed or you provide it through a reachable stylesheet, self-hosted file, or injected @font-face rule.

Why does a declared font not appear in the screenshot?

Check the element’s computed family, weight, and style, then verify the selected face and the font request. A declared but unused face may never load.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Read next

Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.