File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -739,12 +739,22 @@ function isSystemFont(name: string): boolean {
739739 return name . startsWith ( '-' ) || name . startsWith ( 'var(' )
740740}
741741
742+ // fontaine/@nuxt /fonts emit metric-only fallback @font-face entries named
743+ // "<Family> fallback" (e.g. "Sofia Pro fallback") backed by local() Arial/Times.
744+ // They exist purely to reduce CLS in the browser and are not real downloadable
745+ // fonts, so OG renderers must not try to resolve them via fontless providers.
746+ const RE_FONTAINE_FALLBACK = / f a l l b a c k $ / i
747+
748+ function isFontaineFallback ( name : string ) : boolean {
749+ return RE_FONTAINE_FALLBACK . test ( name )
750+ }
751+
742752export function extractCustomFontFamilies ( cssValue : string ) : string [ ] {
743753 return cssValue
744754 . replace ( RE_IMPORTANT , '' )
745755 . split ( ',' )
746756 . map ( p => p . trim ( ) . replace ( RE_QUOTES , '' ) )
747- . filter ( name => name && ! GENERIC_FONT_FAMILIES . has ( name . toLowerCase ( ) ) && ! RE_ONLY_DIGITS . test ( name ) && ! isSystemFont ( name ) )
757+ . filter ( name => name && ! GENERIC_FONT_FAMILIES . has ( name . toLowerCase ( ) ) && ! RE_ONLY_DIGITS . test ( name ) && ! isSystemFont ( name ) && ! isFontaineFallback ( name ) )
748758}
749759
750760// ============================================================================
Original file line number Diff line number Diff line change @@ -626,13 +626,17 @@ export async function resolveOgImageFonts(options: {
626626 const coveredFamilies = new Set ( allFonts . map ( f => f . family ) )
627627 let missingFamilies : string [ ] = [ ]
628628
629+ // Skip fontaine-generated metric fallbacks ("<Family> fallback") — they're
630+ // local() metric shims for CLS, not real downloadable fonts.
631+ const isFontaineFallback = ( name : string ) : boolean => / f a l l b a c k $ / i. test ( name )
632+
629633 if ( fontRequirements . families . length > 0 ) {
630- missingFamilies = fontRequirements . families . filter ( f => ! coveredFamilies . has ( f ) )
634+ missingFamilies = fontRequirements . families . filter ( f => ! coveredFamilies . has ( f ) && ! isFontaineFallback ( f ) )
631635 }
632636 else {
633637 const defaultVar = tw4FontVars [ 'font-sans' ]
634638 if ( defaultVar )
635- missingFamilies = extractCustomFontFamilies ( defaultVar ) . filter ( f => ! coveredFamilies . has ( f ) )
639+ missingFamilies = extractCustomFontFamilies ( defaultVar ) . filter ( f => ! coveredFamilies . has ( f ) && ! isFontaineFallback ( f ) )
636640 }
637641
638642 if ( missingFamilies . length > 0 ) {
You can’t perform that action at this time.
0 commit comments