kvnang / workers-og

An `og:image` (social card) generator that is fast, browser-less (no Puppeteer), and capable of running on the edge. This package is designed to be used with Cloudflare Workers (but may be used elsewhere), with the simple API inspired by `@vercel/og`.
MIT License
194 stars 18 forks source link

Custom fonts? #13

Closed ninjamar closed 2 weeks ago

ninjamar commented 4 months ago

Is there any support for custom fonts?

ninjamar commented 4 months ago

I know I can pass arguments to ImageResponse, but loadGoogleFont isn't exposed. For me, loadGoogleFont has an additional overhead, so I wrote a base64 encoded version of the font to a JavaScript file to be imported.

zerosoul commented 4 months ago

I know I can pass arguments to ImageResponse, but loadGoogleFont isn't exposed. For me, loadGoogleFont has an additional overhead, so I wrote a base64 encoded version of the font to a JavaScript file to be imported.

I want to support Chinese fonts, can you tell me how to do that?

ninjamar commented 4 months ago

I know I can pass arguments to ImageResponse, but loadGoogleFont isn't exposed. For me, loadGoogleFont has an additional overhead, so I wrote a base64 encoded version of the font to a JavaScript file to be imported.

I want to support Chinese fonts, can you tell me how to do that?

Here's how I did it