Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

use custom font

Isaiah Hamiltoneaff262e64be
diff --git a/supabase/functions/og-images/component/Docs.tsx b/supabase/functions/og-images/component/Docs.tsx
index 3bd4dd65d27..eef40786d56 100644
--- a/supabase/functions/og-images/component/Docs.tsx
+++ b/supabase/functions/og-images/component/Docs.tsx
@@ -19,6 +19,7 @@ const Docs = (props: Props) => {
flexDirection: 'column',
color: 'white',
backgroundColor: '#1c1c1c',
+ fontFamily: 'Circular',
backgroundImage: 'url(https://obuldanrptloktxcffvn.supabase.co/storage/v1/object/public/images/og-images/gradient.svg)',
backgroundRepeat: 'no-repeat',
}}
diff --git a/supabase/functions/og-images/handler.tsx b/supabase/functions/og-images/handler.tsx
index 642bc6a94c3..1e7b9ae98bf 100644
--- a/supabase/functions/og-images/handler.tsx
+++ b/supabase/functions/og-images/handler.tsx
@@ -8,16 +8,10 @@ const corsHeaders = {
'Content-Type': 'application/json'
}
-const options = {
- width: 1200,
- height: 600,
- status: 200,
- headers: {
- 'content-type': 'image/png',
- 'cache-control': 'public, max-age=31536000, s-maxage=31536000, no-transform, immutable',
- 'cdn-cache-control': 'max-age=31536000',
- },
-}
+// Load custom font
+const FONT_URL = 'https://obuldanrptloktxcffvn.supabase.co/storage/v1/object/public/images/lw6/CircularStd-Book.otf'
+const font = fetch(new URL(FONT_URL, import.meta.url)).then((res) => res.arrayBuffer())
+const fontData = await font
export async function handler(req: Request) {
const url = new URL(req.url)
@@ -36,7 +30,23 @@ export async function handler(req: Request) {
switch (site) {
case 'docs':
- return new ImageResponse(( <Docs title={title} description={description} type={type} icon={icon} /> ), { ...options })
+ return new ImageResponse(( <Docs title={title} description={description} type={type} icon={icon} /> ),
+ {
+ width: 1200,
+ height: 630,
+ fonts: [
+ {
+ name: 'Circular',
+ data: fontData,
+ style: 'normal',
+ },
+ ],
+ headers: {
+ 'content-type': 'image/png',
+ 'cache-control': 'public, max-age=31536000, s-maxage=31536000, no-transform, immutable',
+ 'cdn-cache-control': 'max-age=31536000',
+ },
+ })
break;
default: