fix: add font-weight param in og image card style (#453)

This commit is contained in:
Pujan Modha
2025-03-09 15:20:00 +05:30
committed by GitHub
parent b51a055e22
commit e08618ad3c
+4 -3
View File
@@ -1,8 +1,9 @@
async function loadGoogleFont( async function loadGoogleFont(
font: string, font: string,
text: string text: string,
weight: number
): Promise<ArrayBuffer> { ): Promise<ArrayBuffer> {
const API = `https://fonts.googleapis.com/css2?family=${font}&text=${encodeURIComponent(text)}`; const API = `https://fonts.googleapis.com/css2?family=${font}:wght@${weight}&text=${encodeURIComponent(text)}`;
const css = await ( const css = await (
await fetch(API, { await fetch(API, {
@@ -51,7 +52,7 @@ async function loadGoogleFonts(
const fonts = await Promise.all( const fonts = await Promise.all(
fontsConfig.map(async ({ name, font, weight, style }) => { fontsConfig.map(async ({ name, font, weight, style }) => {
const data = await loadGoogleFont(font, text); const data = await loadGoogleFont(font, text, weight);
return { name, data, weight, style }; return { name, data, weight, style };
}) })
); );