@@ -29,7 +29,7 @@ function setupInvalidationOnce(root = document.documentElement) {
2929 } catch { }
3030}
3131
32- function snapshotComputedStyleFull ( style ) {
32+ function snapshotComputedStyleFull ( style , options = { } ) {
3333 const out = { } ;
3434 const vis = style . getPropertyValue ( 'visibility' ) ;
3535 for ( let i = 0 ; i < style . length ; i ++ ) {
@@ -40,6 +40,23 @@ function snapshotComputedStyleFull(style) {
4040 }
4141 out [ prop ] = val ;
4242 }
43+ if ( options . embedFonts ) {
44+ const EXTRA_FONT_PROPS = [
45+ "font-feature-settings" ,
46+ "font-variation-settings" ,
47+ "font-kerning" ,
48+ "font-variant" ,
49+ "font-variant-ligatures" ,
50+ "font-optical-sizing" ,
51+ ] ;
52+ for ( const prop of EXTRA_FONT_PROPS ) {
53+ if ( out [ prop ] ) continue ;
54+ try {
55+ const v = style . getPropertyValue ( prop ) ;
56+ if ( v ) out [ prop ] = v ;
57+ } catch { }
58+ }
59+ }
4360 if ( vis === 'hidden' ) out . opacity = '0' ;
4461 return out ;
4562}
@@ -52,11 +69,11 @@ function styleSignature(snap) {
5269 __snapshotSig . set ( snap , sig ) ;
5370 return sig ;
5471}
55- function getSnapshot ( el , preStyle = null ) {
72+ function getSnapshot ( el , preStyle = null , options = { } ) {
5673 const rec = snapshotCache . get ( el ) ;
5774 if ( rec && rec . epoch === __epoch ) return rec . snapshot ;
5875 const style = preStyle || getComputedStyle ( el ) ;
59- const snap = snapshotComputedStyleFull ( style ) ;
76+ const snap = snapshotComputedStyleFull ( style , options ) ;
6077 snapshotCache . set ( el , { epoch : __epoch , snapshot : snap } ) ;
6178 return snap ;
6279}
@@ -103,8 +120,8 @@ export async function inlineAllStyles(source, clone, sessionOrCtx, opts) {
103120 if ( resetMode !== 'disabled' ) setupInvalidationOnce ( document . documentElement ) ;
104121
105122 if ( resetMode === 'disabled' && ! ctx . session . __bumpedForDisabled ) {
106- bumpEpoch ( ) ;
107- snapshotKeyCache . clear ( ) ;
123+ bumpEpoch ( ) ;
124+ snapshotKeyCache . clear ( ) ;
108125 ctx . session . __bumpedForDisabled = true ;
109126 }
110127
@@ -120,7 +137,7 @@ export async function inlineAllStyles(source, clone, sessionOrCtx, opts) {
120137 }
121138 const pre = session . styleCache . get ( source ) ;
122139
123- const snap = getSnapshot ( source , pre ) ;
140+ const snap = getSnapshot ( source , pre , ctx . options ) ;
124141
125142 const sig = styleSignature ( snap ) ;
126143 let key = persist . snapshotKeyCache . get ( sig ) ;
0 commit comments