This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { render } from "https://deno.land/x/resvg_wasm@0.2.0/mod.ts"; | |
| import { Page, PageData } from "lume/core.ts"; | |
| import satori, { SatoriOptions } from "npm:satori"; | |
| /* We never want our beautiful PNGs to have a layout :-) */ | |
| export const layout = undefined; | |
| /* Load fonts. We can't use variable fonts unfortunately. */ | |
| const inter = await Deno.readFile("./src/fonts/Inter-Regular.ttf"); | |
| const interBold = await Deno.readFile("./src/fonts/Inter-Bold.ttf"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import satori from 'satori' | |
| import fs from 'fs' | |
| // fetch font information | |
| const endpoint = new URL('https://www.googleapis.com/webfonts/v1/webfonts'); | |
| endpoint.searchParams.set('family', 'M PLUS Rounded 1c'); | |
| endpoint.searchParams.set('key', process.env.GOOGLE_FONTS_API_KEY); | |
| const fontInfo = await fetch(endpoint).then(res => res.json()); | |
| // fetch font |