@@ -44,6 +44,7 @@ const CREDIT_FONT = '12px "Helvetica Neue", Helvetica, Arial, sans-serif'
4444const CREDIT_LINE_HEIGHT = 16
4545const HEADLINE_TEXT = 'SITUATIONAL AWARENESS: THE DECADE AHEAD'
4646const HEADLINE_FONT_FAMILY = '"Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, serif'
47+ const HEADLINE_PRELOAD_FONT = `700 96px ${ HEADLINE_FONT_FAMILY } `
4748const HINT_PILL_SAFE_TOP = 72
4849const NARROW_BREAKPOINT = 760
4950const NARROW_COLUMN_MAX_WIDTH = 430
@@ -199,6 +200,20 @@ function createLogo(className: string, alt: string, src: string): HTMLImageEleme
199200 return element
200201}
201202
203+ async function waitForInitialLayoutAssets ( ) : Promise < void > {
204+ // `document.fonts.ready` only waits for faces currently used in the DOM.
205+ // Our measured title/body text is mounted after this await, so preload the
206+ // exact faces we measure with canvas before the first render.
207+ if ( 'fonts' in document ) {
208+ await Promise . all ( [
209+ document . fonts . ready ,
210+ document . fonts . load ( BODY_FONT , BODY_COPY . slice ( 0 , 96 ) ) ,
211+ document . fonts . load ( CREDIT_FONT , CREDIT_TEXT ) ,
212+ document . fonts . load ( HEADLINE_PRELOAD_FONT , HEADLINE_TEXT ) ,
213+ ] )
214+ }
215+ }
216+
202217function mountStaticNodes ( ) : void {
203218 stage . append (
204219 domCache . headline ,
@@ -209,7 +224,7 @@ function mountStaticNodes(): void {
209224}
210225
211226const [ , openaiLayout , claudeLayout , openaiHit , claudeHit ] = await Promise . all ( [
212- document . fonts . ready ,
227+ waitForInitialLayoutAssets ( ) ,
213228 getWrapHull ( OPENAI_LOGO_SRC , { smoothRadius : 6 , mode : 'mean' } ) ,
214229 getWrapHull ( CLAUDE_LOGO_SRC , { smoothRadius : 6 , mode : 'mean' } ) ,
215230 getWrapHull ( OPENAI_LOGO_SRC , { smoothRadius : 3 , mode : 'mean' } ) ,
0 commit comments