@@ -32,12 +32,6 @@ export async function serveIcon(context: GitBookSiteContext, req: Request) {
32
32
33
33
const { site, customization } = context ;
34
34
const customIcon = 'icon' in customization . favicon ? customization . favicon . icon : null ;
35
-
36
- console . log (
37
- 'icon: serveIcon' ,
38
- req . url ,
39
- customIcon ? 'custom' : 'emoji' in customization . favicon ? 'emoji' : 'fallback'
40
- ) ;
41
35
// If the site has a custom icon, redirect to it
42
36
if ( customIcon ) {
43
37
const iconUrl = options . theme === 'light' ? customIcon . light : customIcon . dark ;
@@ -50,18 +44,6 @@ export async function serveIcon(context: GitBookSiteContext, req: Request) {
50
44
}
51
45
52
46
const contentTitle = site . title ;
53
-
54
- // Load the font locally to prevent the shared instance used by ImageResponse.
55
- const fontOrigin = await fetch (
56
- new URL ( '../fonts/Inter/Inter-Regular.ttf' , import . meta. url )
57
- ) . then ( ( res ) => res . arrayBuffer ( ) ) ;
58
- const dst = new ArrayBuffer ( fontOrigin . byteLength ) ;
59
- new Uint8Array ( dst ) . set ( new Uint8Array ( fontOrigin ) ) ;
60
-
61
- if ( ( 'detached' in dst && dst . detached ) || dst . byteLength === 0 ) {
62
- console . log ( 'about to use detached font buffer..' ) ;
63
- }
64
-
65
47
return new ImageResponse (
66
48
< div
67
49
tw = { tcls ( options . theme === 'light' ? 'bg-white' : 'bg-black' , size . boxStyle ) }
@@ -71,7 +53,7 @@ export async function serveIcon(context: GitBookSiteContext, req: Request) {
71
53
display : 'flex' ,
72
54
alignItems : 'center' ,
73
55
justifyContent : 'center' ,
74
- fontFamily : 'Inter ' ,
56
+ fontFamily : 'system-ui, sans-serif ' ,
75
57
} }
76
58
>
77
59
< h2
@@ -90,14 +72,9 @@ export async function serveIcon(context: GitBookSiteContext, req: Request) {
90
72
{
91
73
width : size . width ,
92
74
height : size . height ,
93
- fonts : [
94
- {
95
- data : dst ,
96
- name : 'Inter' ,
97
- weight : 400 ,
98
- style : 'normal' ,
99
- } ,
100
- ] ,
75
+
76
+ // Explicitly disable any fonts to avoid ArrayBuffer detachment errors.
77
+ fonts : [ ] ,
101
78
}
102
79
) ;
103
80
}
0 commit comments