bluesky quote bot

fixed Google Font URLs

+11 -8
+4
deno.json
··· 11 11 "exclude": [ 12 12 "public/bundle.js" 13 13 ] 14 + }, 15 + "fmt": { 16 + "useTabs": true, 17 + "indentWidth": 4 14 18 } 15 19 }
+7 -8
utils/imageUtils.ts
··· 25 25 26 26 const fonts: Record<string, Font> = { 27 27 normal: { 28 - url: "https://github.com/google/fonts/raw/refs/heads/main/ofl/merriweather/Merriweather-Regular.ttf", 28 + url: "https://github.com/google/fonts/raw/refs/heads/main/ofl/merriweather/Merriweather%5Bopsz,wdth,wght%5D.ttf", 29 29 family: "Merriweather", 30 30 weight: "400", 31 31 }, 32 32 italic: { 33 - url: "https://github.com/google/fonts/raw/refs/heads/main/ofl/merriweather/Merriweather-Italic.ttf", 33 + url: "https://github.com/google/fonts/raw/refs/heads/main/ofl/merriweather/Merriweather-Italic%5Bopsz,wdth,wght%5D.ttf", 34 34 family: "Merriweather", 35 35 weight: "400", 36 36 }, ··· 43 43 font.data = fontData; 44 44 }), 45 45 ); 46 + 47 + // Parse font 48 + const fontData: ArrayBuffer = fonts.normal.data!; 49 + const font = fontkit.create(Buffer.from(fontData)); 46 50 47 51 function formatText(quote: string) { 48 52 const paragraphs = quote.split("\\n"); ··· 134 138 135 139 function measureText( 136 140 text: string, 137 - fontSize: number = defaultFontSize, 138 - fontData: ArrayBuffer = fonts.normal.data!, 139 141 ) { 140 - // Parse font 141 - const font = fontkit.create(Buffer.from(fontData)); 142 - 143 142 // Get width (scale based on fontSize) 144 - const scale = fontSize / font.unitsPerEm; 143 + const scale = defaultFontSize / font.unitsPerEm; 145 144 const width = font.layout( 146 145 text.replace(/\*/g, "") 147 146 .replace(" ", " "), // hack, because single space made it look smushed