From e08618ad3c03bfe95de428a6b5904f0ad0347c33 Mon Sep 17 00:00:00 2001 From: Pujan Modha <109509620+pujan-modha@users.noreply.github.com> Date: Sun, 9 Mar 2025 15:20:00 +0530 Subject: [PATCH] fix: add font-weight param in og image card style (#453) --- src/utils/loadGoogleFont.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/utils/loadGoogleFont.ts b/src/utils/loadGoogleFont.ts index f34716e..dab792e 100644 --- a/src/utils/loadGoogleFont.ts +++ b/src/utils/loadGoogleFont.ts @@ -1,8 +1,9 @@ async function loadGoogleFont( font: string, - text: string + text: string, + weight: number ): Promise { - 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 ( await fetch(API, { @@ -51,7 +52,7 @@ async function loadGoogleFonts( const fonts = await Promise.all( 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 }; }) );