Skip to content

Fonts missing from Chromium MHTML saves (known Chromium bug) #2

Description

@monneyboi

Problem

When saving pages as MHTML using Chromium (including via Playwright or CDP's Page.captureSnapshot), web fonts are frequently missing from the archive. The @font-face declarations in CSS reference font files by URL path, but the actual font binaries are not included as MIME parts.

Root cause

This is a known, long-standing Chromium bug: chromium issue 40219015

Chromium's FrameSerializer has code to embed fonts (AddFontToResources()), but it checks font.IsLoaded() and font.ResourceBuffer() at save time. If a font was lazily loaded or has been evicted from the resource cache, it is silently skipped. There is no Chrome flag or setting to control this behavior.

Workarounds

  • Ensuring all fonts are fully loaded before saving (e.g., using document.fonts.ready in Playwright) may improve results, but is not guaranteed.
  • SingleFile (browser extension) actively fetches and embeds all resources including fonts, but is not usable in headless/Playwright workflows.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions