fix(producer): skip @font-face injection for OS system fonts#311
Closed
Pran-Ker wants to merge 1 commit intoheygen-com:mainfrom
Closed
fix(producer): skip @font-face injection for OS system fonts#311Pran-Ker wants to merge 1 commit intoheygen-com:mainfrom
Pran-Ker wants to merge 1 commit intoheygen-com:mainfrom
Conversation
The GENERIC_FAMILIES set only covers CSS generic keywords (sans-serif, serif, monospace, etc.) but not named system fonts like Courier New, Arial, Helvetica, or Georgia. When a composition uses a font-family stack such as `'Courier New', Courier, monospace`, the compiler picks up "Courier New" and "Courier" as unresolved web fonts and attempts Google Fonts resolution. In headless render environments this produces [non-blocking] 404 errors for every system font in every stack. Add a SYSTEM_FONTS constant covering ~120 well-known pre-installed fonts across Windows, macOS, and Linux. Extend the skip guard in extractRequestedFontFamilies() to bail on these alongside the existing generic-family check. Fixes the spurious 404 noise reported when rendering compositions that use common font stacks like Courier New, Tahoma, Verdana, Helvetica Neue, etc.
jrusso1020
added a commit
that referenced
this pull request
Apr 18, 2026
Chrome's "Failed to load resource" message text does not include the failing URL — it's only on msg.location().url. The previous filter in frameCapture.ts only checked msg.text(), so every font 404 (e.g. Google Fonts <link> tags in sandboxed render environments) fell through to the "[non-blocking]" prefix instead of being suppressed. Extract the classifier into isFontResourceError() and match against both text and location.url, and extend the extension match to .ttf/.otf. Adds a unit test covering the URL-in-location, URL-in-text, and non-font cases. This is a targeted fix for the render-output noise that PR #311 attempted to address by adding a ~120-entry SYSTEM_FONTS skip list. That approach silently shadowed existing FONT_ALIASES (arial→inter, helvetica→inter, courier new→jetbrains-mono, segoe ui→roboto, etc.) and changed render output on Linux fleets that don't have those fonts installed. Fixing the console-log filter here suppresses the noise without changing any font resolution behavior. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Collaborator
|
@Pran-Ker Thanks for raising this PR and surfacing the issue! After a deeper look I put up a PR here #313 to help suppress the noisy log. The concern with the approach you took is that it could change our font resolution logic leading to visual inconsistencies between preview and render, so we wanted to take a slightly safer route! |
jrusso1020
added a commit
that referenced
this pull request
Apr 18, 2026
…#313) Chrome's "Failed to load resource" message text does not include the failing URL — it's only on msg.location().url. The previous filter in frameCapture.ts only checked msg.text(), so every font 404 (e.g. Google Fonts <link> tags in sandboxed render environments) fell through to the "[non-blocking]" prefix instead of being suppressed. Extract the classifier into isFontResourceError() and match against both text and location.url, and extend the extension match to .ttf/.otf. Adds a unit test covering the URL-in-location, URL-in-text, and non-font cases. This is a targeted fix for the render-output noise that PR #311 attempted to address by adding a ~120-entry SYSTEM_FONTS skip list. That approach silently shadowed existing FONT_ALIASES (arial→inter, helvetica→inter, courier new→jetbrains-mono, segoe ui→roboto, etc.) and changed render output on Linux fleets that don't have those fonts installed. Fixing the console-log filter here suppresses the noise without changing any font resolution behavior. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
GENERIC_FAMILIESonly covers CSS generic keywords (sans-serif,serif,monospace, etc.) but not named OS system fonts. When a composition uses a font-family stack like:The compiler extracts
Courier NewandCourieras unresolved web fonts and attempts Google Fonts resolution for them. In headless render environments (the primary use case forhyperframes render) this produces[non-blocking] Failed to load resource: 404for every system font in every stack — one per font name per composition.The noise appears in the render output like this:
Even when the fallback to the OS font works correctly, this is misleading and wastes resolution time. For fonts without an alias (e.g.
Arial,Tahoma,Georgia,Helvetica Neue) the compiler hits Google Fonts — which always fails in a sandboxed headless renderer — before falling back.Fix
Add a
SYSTEM_FONTSconstant covering ~120 well-known pre-installed fonts across Windows, macOS, and Linux. Extend the skip guard inextractRequestedFontFamilies()to bail on these alongside the existingGENERIC_FAMILIEScheck.System fonts are already present on the render machine — injecting
@font-facefor them is unnecessary and actively harmful in headless environments.Fonts covered
Testing
Reproduce before this fix by creating a composition with
font-family: 'Courier New', Courier, monospaceand runningnpx hyperframes render. The 404 noise disappears after this change.