Skip to content

Commit 42f03ca

Browse files
committed
perf: use built in og font
1 parent 3313c86 commit 42f03ca

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

src/app/api/og/route.tsx

+15-13
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ import type { NextRequest } from 'next/server'
55

66
import { apiClient } from '~/lib/request'
77

8-
const fontNormal = fetch(
9-
'https://github.com/lxgw/LxgwWenKai/releases/download/v1.300/LXGWWenKai-Regular.ttf',
10-
).then((res) => res.arrayBuffer())
8+
// const fontNormal = fetch(
9+
// 'https://github.com/lxgw/LxgwWenKai/releases/download/v1.300/LXGWWenKai-Regular.ttf',
10+
// ).then((res) => res.arrayBuffer())
1111
// export const runtime = 'edge'
1212

1313
export const revalidate = 60 * 60 * 24 // 24 hours
1414
export const GET = async (req: NextRequest) => {
1515
try {
16-
const fontData = await fontNormal
16+
// const fontData = await fontNormal
1717

1818
const { searchParams } = req.nextUrl
1919

@@ -104,7 +104,8 @@ export const GET = async (req: NextRequest) => {
104104

105105
background: `linear-gradient(37deg, ${bgAccent} 27.82%, ${bgAccentLight} 79.68%, ${bgAccentUltraLight} 100%)`,
106106

107-
fontFamily: 'LXGW WenKai Screen R',
107+
// fontFamily: 'LXGWWenKai',
108+
fontFamily: 'Inter, "Material Icons"',
108109

109110
padding: '5rem',
110111
alignItems: 'flex-end',
@@ -177,14 +178,15 @@ export const GET = async (req: NextRequest) => {
177178
{
178179
width: 1200,
179180
height: 600,
180-
fonts: [
181-
{
182-
name: 'LXGW WenKai Screen R',
183-
data: fontData,
184-
weight: 400,
185-
style: 'normal',
186-
},
187-
],
181+
emoji: 'twemoji',
182+
// fonts: [
183+
// {
184+
// name: 'LXGW WenKai Screen R',
185+
// // data: fontData,
186+
// weight: 400,
187+
// style: 'normal',
188+
// },
189+
// ],
188190
},
189191
)
190192
} catch (e: any) {

0 commit comments

Comments
 (0)